Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Scalable realtime application
How can I scale my realtime application?
If I store the application's state in something like memcached, will updating the state from another thread cause any problem?
And how can I push? Do I have to build some shardable non-blocking connection server to hold the connection?
For multi-threaded applications, please see this sticky. It is a good explanation of the problems and workarounds.
There are in the directory several plugins to handle push (see here), check the doc for each of them for more details.
As for state, you should take a look at this part of the book and this wiki article. While they are not directly aimed to solve your problem they go over lots of "do and don't" with the application state data.
I have successfully built an realtime application with spring and ICEPush.
My previous project didn't have the scalability requirement,
so I store conversational state in session scope spring bean, a list of applications in singleton scope bean.
I also overused ThreadLocal for BeanUtil and Blackboard.
I'm thinking of define some custom bean scope for spring (to store state in memcached instead of session for example).
I'm just wondering if it scales. And is it poorly designed?