News for hackers. Stuff that matters.
Re:Play framework for Java - a radical rethink of Java web a... by jrockway on Friday October 23, 2009 @10:27AM (#898801)
Java has real lightweight threads, so what's the advantage of "shared nothing" here? Extra memory usage and less speed?
Re:Play framework for Java - a radical rethink of Java web a... by mcav on Friday October 23, 2009 @11:18AM (#898897)
It seems to refer to this:

> "Play is designed to operate in a ‘share nothing’ architecture. The idea is to keep the application completely stateless. By doing this you will allow your application to run on as many server nodes as needed at the same time.

>What are the common traps you should avoid to keep the model stateless? Do not store any object on the Java heap for multiple requests"

If that's all they're talking about when they say "stateless", that's no different than a lot of other "stateless" MVC frameworks like Pylons, Django, Rails, etc.

Re:Play framework for Java - a radical rethink of Java web a... by modoc on Friday October 23, 2009 @12:22PM (#899050)
I haven't done any real dev with those frameworks you list so I'm wondering how do you manage session state? user profile, shopping cart, breadcrumbs, multi-request flows, etc...

Do you write/read all that into the db/memcached for each request?

Re:Play framework for Java - a radical rethink of Java web a... by mcav on Friday October 23, 2009 @01:03PM (#899147)
Yes. PHP does the same thing. Actually, most frameworks do that; very few keep state within the application server between requests. Statelessness, in that respect, improves scalability.
Re:Play framework for Java - a radical rethink of Java web a... by modoc on Friday October 23, 2009 @02:25PM (#899322)
PHP has session variables to put state objects into which are persisted between requests. Right?
Re:Play framework for Java - a radical rethink of Java web a... by simonw on Friday October 23, 2009 @02:34PM (#899343)
Yes, but most people who make serious use of them hook up a custom session handler that writes session information out to the database (the default implementation that ships with PHP uses the file system). Sessions that are stored in memory by the application server instantly prevent you from load balancing requests across multiple servers and hence kill your scalability - unless you implement sticky sessions which adds yet more complexity. Personally I try to avoid using session storage whenever possible - I've recently started using signed cookies in their place.
Re:Play framework for Java - a radical rethink of Java web a... by modoc on Friday October 23, 2009 @03:04PM (#899415)
Interesting. I mostly build J2EE apps and sticky sessions support is built in. Complex apps require a fair bit of session state (user profile, shopping cart, custom catalog, breadcrumbs, user promos, etc...) in general and the idea of having to persist and reload that data over a network (db or memcached) for each request would absolutely kill page response times. I guess it depends on how heavy the session data is for your app.
Re:Play framework for Java - a radical rethink of Java web a... by modoc on Friday October 23, 2009 @04:43PM (#899587)
jshen: sticky sessions make it a non-issue. Sites I work on run on 3-100 server clusters with each server handling a few thousand active sessions.

I know memcached is very fast. However it's at least an order of magnitude, or more, slower than in memory lookups. Given how simple sticky sessions are I guess I'm not sure why you'd want to incur the overhead of re-buildling your state via external network calls and object serialization/marshalling/etc... for every request, and doing it all backwards at the end of every request.

Re:Play framework for Java - a radical rethink of Java web a... by simonw on Friday October 23, 2009 @07:34PM (#899819)
I'm quite surprised - I've never even considered building a stateful web app that doesn't talk to a database or caching layer at all for most requests. It's fascinating to me how different the approaches taken in the Java world are from the LAMP world I'm accustomed to.
Re:Play framework for Java - a radical rethink of Java web a... by modoc on Saturday October 24, 2009 @04:11PM (#900888)
From the Java world, that seems odd:) Scaling your DB and/or caching layer is a lot harder than scaling sticky session based app instance with minimal db interaction.
Re:Play framework for Java - a radical rethink of Java web a... by jshen on Friday October 23, 2009 @04:23PM (#899557)
how long do you believe it takes to grab data out of memcached? I'll bet it's a lot faster than you think.

Of course, if you keep that state in memory then you are fucked when you need more than one web app server to handle the load.

Re:Play framework for Java - a radical rethink of Java web a... by mcav on Friday October 23, 2009 @02:33PM (#899342)
PHP's sessions are stored in files by default, not persisted in memory.
Re:Play framework for Java - a radical rethink of Java web a... by ilyak on Friday October 23, 2009 @02:10PM (#899295)
...while reducing perfomance...
Re:Play framework for Java - a radical rethink of Java web a... by mcav on Friday October 23, 2009 @02:36PM (#899351)
Yeah. Sometimes per-request page performance is less important than overall throughput, though.
Re:Play framework for Java - a radical rethink of Java web a... by jshen on Friday October 23, 2009 @12:53PM (#899125)
typically your session data is stored outside of the web app process. It could be in files, memcached, db, cookies, etc.
Re:Play framework for Java - a radical rethink of Java web a... by ConceptDog on Friday October 23, 2009 @11:33AM (#898923)
There's also the option to pack the entire solution into a WAR for deployment within a web app container. Tho the lightweight server is a cool approach.

I'd like to see the Play server support fcgi rather than having it deployed behind a webserver acting as a proxy for load balanced deployment.

Re:Play framework for Java - a radical rethink of Java web a... by bad_user on Friday October 23, 2009 @12:21PM (#899046)
Java's threads are managed in kernel space, not at the VM level and are definitely not "lightweight".

They are faster than forking processes though, but Java applications (because they share state between threads) are less scalable.