[Seaside] Nginx Load-Balancing Experiences ?

Sven Van Caekenberghe sven at stfx.eu
Thu Apr 24 14:44:43 UTC 2014

On 24 Apr 2014, at 16:31, Esteban A. Maringolo <emaringolo at gmail.com> wrote:

> Are you storing Seaside sessions in memcache?

No, not as such. 

The ip_hash directive tells nginx to send all requests from the same IP to the same Seaside worker image, one way to implement sticky sessions. But of course, when one of the workers of the pool fails, either because of a crash or because of updates, requests will move (temporarily) to another worker.

Then the user will lose its session.

Users also lose sessions when they are timed out.

To fix this, I implemented both http://book.seaside.st/book/in-action/session/recovering on some pages as well as an extra cookie (login-token) that remains valid for 14 days. It is that cookie that is stored in memcached and thus shared among workers (the user might move and get another IP). 

The cookie is used to recover the login and keep the illusion of maintaining the session (even though it actually changed from Seaside's perspective). The only disadvantage is that often the user will go back to the web page, click on something, and first get the page back (session/login recovery) and then has to click again to make the action work. I don't think there is a way around that unless you want to give up on Seaside's generated links.


More information about the seaside mailing list