News for hackers. Stuff that matters.
Re:Strata Web Framework by Roboprog on Wednesday September 21, 2011 @09:03AM (#3021810)
I'm still pretty new to the idea of node.js, but a couple things stand out to me. This framework uses a session cookie as a way to store some data, not just as a user/session id/authentication. Thus, they seem to be strongly pushing you towards an external session store such as memcached or a database. (I suppose that is an inherit limitation of node.js, at least as commonly used)

From what I understand, a Node/V8 instance really only utilizes a single CPU, yes? As a request does I/O, some other piece of code is executed until (some time after) the async I/O completes. A CPU can be effectively timesharing over several pseudo-threads, but to use a SMP chip/server, you have to run multiple instances, with a front-end load balancer. I guess this would drive one towards an external session data solution, barring some kind of sticky session and a reason to be sticky.

Re:Strata Web Framework by bretthoerner on Wednesday September 21, 2011 @09:14AM (#3021850)
Isn't an external session store practically mandatory regardless of your backend?

I'm no fan of Node, but even if you have $100k machine running the JVM with a thousand threads you will (if successful) eventually need a second machine, and a third, etc. Not to mention persistence (what if you need to restart the app server?).

Sessions belong in a database of some kind unless you can get away with signed cookies.

Re:Strata Web Framework by mahmud on Wednesday September 21, 2011 @09:45AM (#3021945)
no it's not mandatory. We use Play and it's super stateless. nothing more than client side cookies. forced us into scalable, share nothing design. love it!

http://playframework.org/

for java and scala

Re:Strata Web Framework by hello_moto on Wednesday September 21, 2011 @10:27AM (#3022099)
I assume play does not use DB pooling if it is a pure 100% share-nothing design?
Re:Strata Web Framework by SkyMarshal on Wednesday September 21, 2011 @10:00AM (#3021998)
The Lift web framework does this too, as does Apple's Web Objects. David Pollack, creator of Lift, wrote a good explanation of the benefits on Quora, will post it shortly.
Re:Strata Web Framework by bronson on Wednesday September 21, 2011 @11:32AM (#3022368)
EDIT: Strata ships with cookie-based sessions but it's pretty easy to write your own storage middleware: var app = strata.redisSession(app, options);

After seeing how awesome the default cookie-based sessions are in Rails, I'm not sure I'd ever care to go back. Maybe for a high security banking app where breaking the cookie encryption could have catastrophic, permanent repercussions? Short of that, load balancing shared-nothing cookie-based sessions is a joy. Gotta agree with the Lift guys there.

Re:Strata Web Framework by SkyMarshal on Wednesday September 21, 2011 @12:03PM (#3022498)
Can't edit my post, so here's David's case (in comments under Jackson Davis's answer):

http://www.quora.com/What-are-the-advantages-and-disadvantag...

"In practice, scaling a Lift site is much much easier than scaling a LAMP site. Why? Well, state exists someplace. If it exists in the JVM, you get a lot of performance benefits and stability as well as, in Lift's case, lots of security. Contrast that with sessions in memcached. "Whoop, memcached went down, there go a pile of sessions." "Whoops, we've got a new memcached hashing algorithm, there go all the session." "Whoops, Google just crawled us creating 200,000 new sessions pushing all the but the active sessions out of cache." "Whoops, the Ruby runtime just went wild, ate all the VM on one of our boxes, memcached went down..." So, you try storing sessions in some wacky shared version of MySQL. This solution requires tons of hardware and a team of make sure that the sharing code is correct, etc. Contrast that to using Nginx, Jetty and session affinity. It's about 4 hours of setup time and it just works. See http://blog.harryh.org/post/7550... So, talk to a Facebook engineer about the challenges they go through to manage state between the front end, memcached, MySQL, etc. Compare that to Twitter with the famous fail whale. Compare that to Apple's store and the iTunes store which are written on WebObject (which is highly stateful.) Lift apps running at scale typically require 7% of the front end resources of LAMP app. The Lift apps that are running at scale (Foursquare and Novell pulse are two) do not have the kind of scaling issues associated with LAMP sites that have similar traffic patterns. Scaling with Lift is neither tricky, nor risky. It's simple. It's known. It's proven. Scaling with LAMP is playing whack-a-mole with state and that only becomes a problem at scale."

Re:Strata Web Framework by bretthoerner on Wednesday September 21, 2011 @07:01PM (#3024049)
I'm confused, are they saying Twitter etc have scaling problems because of sessions?

Sessions are just about the easiest thing to scale. What am I missing here?

Re:Strata Web Framework by olegp on Wednesday September 21, 2011 @03:57PM (#3023416)
Java web app containers support distributed session stores.
Re:Strata Web Framework by judofyr on Wednesday September 21, 2011 @09:43AM (#3021938)
All the session data is stored (and signed) in a cookie on the client side. Why would you need an external session store then? Isn't it more like the opposite; with this solution you never need an external session store, no matter how many instance you run?
Re:Strata Web Framework by joeyespo on Wednesday September 21, 2011 @10:45AM (#3022178)
I think he means that by using cookies, you're constrained to their limits. So if you have a large amount of data to pass around, you'll be forced into something external.
Re:Strata Web Framework by mjijackson on Wednesday September 21, 2011 @12:28PM (#3022613)
The fact that Strata uses cookies for sessions is just a personal preference, and certainly isn't something that is forced upon you. It would not be very difficult to add support for file or database-backed sessions into the core distribution.