Most Java web application frameworks use server-side session objects to store session state. Because this complicates scaling, I'm looking at frameworks that implement a shared-nothing architecture, e.g. the Play! Framework and Apache Click. What other frameworks should I add to this list?
-
1Well... You could use the same techniques in any framework, and some would let you integrate `Cache`-like lookup into whatever EL is used in the view layer. – Dave Newton Jan 13 '12 at 19:30
-
1Multiple fallacies here: 1) in most cases, you don't *have* to use "sessions" if you don't want to, 2) Just because you use a session, doesn't *necessarily* make your web app "unscalable". "Scalability" depends on your architecture, which in turn depends on your requirements. *Please* don't put the cart before the horse, *please* don't indulge in "premature optimization" (which, as we know, is the "root of all evil") ;) IMHO... – paulsm4 Jan 13 '12 at 19:41
-
Should have mentioned that I need to allow users to log in. Most frameworks support this using server-side sessions. This means replicating session objects across machines and/or setting up sticky sessions. Being able to scale beyond a single machine is a requirement here, not a "premature optimization"... So, all else being equal, using a framework that doesn't require a lot of state (e.g. Wicket) and that stores state that is needed on the client (using encrypted cookies) seems simpler and more appropriate. – ejain Jan 13 '12 at 20:30
-
Dave Newton said it very well above. Q: Have you looked into something like Memcached? http://www.softwareprojects.com/resources/programming/t-memcached-for-php-sessions-1654.html – paulsm4 Jan 14 '12 at 03:43
-
I have looked at Hazelcast, which is simple to set up (i.e. it can be embedded into the webapp and supports EC2 Auto Discovery). However, the question wasn't what the most appropriate architecture for my application is, but what other frameworks handle state like Play! (or GWT, as someone pointed out) does. – ejain Jan 14 '12 at 04:07
4 Answers
Take any of MVC frameworks, just don't use sessions. It's dead simple: most of them do not use session by themselves, it is you who decide whether to put anything into a session.

- 8,377
- 24
- 45
GWT framework - you write full AJAX application, so you can store everything you need on client side and to server send only authorization tokens (which could be stored in memory singleton or in database for verification).
Any javascript solution for client side, where you can do the same. On client side you can use Spring MVC just for implementing business methods and allowing them via REST channels (JSON as data transfer protocol is the preferred option).

- 1
- 38
- 145
- 223
Play framework should provide everything you need as it was designed with stateless principles. As mentioned other framework could do the trick but play is a full stack and geared for rapid development (probably the equivalent of ruby on rails for java). You can easily and quickly develop fully fledged web application with user authentication and authorisation. I would strongly advice to go through the tutorial. Java development has never been so productive and fun!

- 4,846
- 7
- 37
- 58
Restlet (2.1) has a CookieAuthenticator that handles authentication without reliance on server-side sessions, so that's another framework that can be added to the list.

- 3,456
- 2
- 34
- 52