Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sticky sessions in fastrouter/httprouter #83

Closed
unbit opened this issue Dec 11, 2012 · 3 comments
Closed

Sticky sessions in fastrouter/httprouter #83

unbit opened this issue Dec 11, 2012 · 3 comments

Comments

@unbit
Copy link
Owner

unbit commented Dec 11, 2012

When some kind of async database replica is in place, having the same client connecting to the same backend is the best solution to avoid incongruences in responses (mainly caused by sync gaps)

Sticky sessions are a common technique, but as always i want to give them to uWSGI users with little effort from a code-changing point of view.

My idea is setting a cookie in the fastrouter with the address of the backend (encrypted).

The encrypted blob should contain the ip address of the client, the backend node (obviously), a random IV and should support different kind of keys (from preshared keys to the same certificate used by the secured subscription system)

If the fastrouter find the cookie already set in the request it will simply decrypt it and use the supplied address.

Obviously an api function could be added (like uwsgi.sticky()) to generate the encrypted blob from the app only for the requests requiring it.

@unbit
Copy link
Owner Author

unbit commented Jul 12, 2014

now it is easy to implement custom algos for routers. The uWSGI 2.1 iphash one should be used for stickyness

@EndenDragon
Copy link

@unbit How does one implement the iphash? I'm from miguelgrinberg/Flask-SocketIO#535 and I do not know where to start.

@johaven
Copy link

johaven commented Apr 24, 2020

now it is easy to implement custom algos for routers. The uWSGI 2.1 iphash one should be used for stickyness

When this will be available ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants