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

Is there a simple way to scale Flask-SocketIO apps using a Docker Swarm deployment scheme? #1402

Closed
dhhagan opened this issue Nov 6, 2020 · 4 comments
Labels

Comments

@dhhagan
Copy link

dhhagan commented Nov 6, 2020

What is the simplest setup for scaling Flask-SocketIO via a Docker Swarm deployment scheme?

I've read through a few of the closed issues on this forum (ex. #694, #618, #1401) and believe I understand the crux of the limitations for scaling a Flask-SocketIO deployment when using gunicorn - mostly due to lack of support for sticky sessions. I've seen your solution to scaling by starting several instances on different ports and using Nginx to load balance them. However, I was wondering if there was an approach that was easily compatible with a typical Docker Swarm deployment, where you may want to scale your SocketIO app to 3+ replicates. I've started looking through this example, and will continue to try it, but was hoping to get your/others thoughts before spending too much time in case there was something I was missing or a tutorial on the internet that I have missed.

@miguelgrinberg
Copy link
Owner

I don't use Docker swarm, so I don't know. I've made it work with Kubernetes back in the day, using a Haproxy load balancer configured with sticky sessions and a Redis for communication between the replicas.

@dhhagan
Copy link
Author

dhhagan commented Apr 6, 2021

Hey @miguelgrinberg I did end up getting this to work quite well using Traefik instead of Nginx as the reverse proxy. Do you have any recommendations on the best place to post a solution so that others can find it if needed?

@miguelgrinberg
Copy link
Owner

@dhhagan You can post it here. The added context of our discussion above will make your solution more Google/SEO friendly.

@LostInDarkMath
Copy link

@dhhagan Could you please share your solution with us? :)

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

No branches or pull requests

3 participants