Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

we'd like to migrate to nginx and want to have the same behaviour as we have at the moment:

We're using the following load balancing setup: Apache mod_jk with AJP connected to JBoss 4.2.3 workers. Installed JKStatusManager to configure worker settings online. Workers have sticky sessions. There is no session replication for session failover.

Unfortunately we cannot enable session replication for session failover because our session state is too big (JSF). We cannot move to client side replication because the session state is too big.

When we need to update the workers we do the following:

  • Disable 50% of the workers
  • wait about 60 minutes until these workers have 0 clients connected
  • update these workers
  • enable these workers
  • do the same for the other 50%

This is not optimal but it works very well.

Question: is it possible to achieve the same behaviour with nginx? (except AJP connections. We would like to use HTTPS in the backend with nginx-module HttpProxyModule)

share|improve this question
Not without changes to the source code of nginx. – Martin Fjordvald Sep 21 '11 at 11:40
I think you could get most of the way with something like but I don't think this handles the graceful off-load you mentioned and would require modifications. – polynomial Sep 22 '11 at 2:23

Like Martin F said, what you want can't be done without hacking nginx -- If you're going to do that you may want to invest programming resources elsewhere instead.

You say your session data is "too big" to replicate -- How big is "too big"?
Beyond a certain point it's time to manage your own session information and put the state data in a distributed database (possibly a nice NoSQL DB like Mongo) and let that handle the replication for you...

share|improve this answer
Seconded. This usually also means that in a data center power failure the application won't be able to come back on-line due to the session setup issues. – polynomial Sep 22 '11 at 2:23
The session state can get up to 5MB :-( This is because JSF stores its component tree in the session and we can't get rid of this. – Marcel Sep 22 '11 at 10:08

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.