Replies: 9 comments
-
Have you seen the documentation on using multiple workers? https://flask-socketio.readthedocs.io/en/latest/#using-multiple-workers |
Beta Was this translation helpful? Give feedback.
-
Sir I readed it but can you show a example of CLI |
Beta Was this translation helpful? Give feedback.
-
I don't have any examples other than those in the documentation, sorry. If you've never done a multiworker deployment then this is going to be hard for you, but if you are familiar with the basics of the deployment, then deploying Socket.IO is similar. |
Beta Was this translation helpful? Give feedback.
-
Sir I have done multiworker deployment but the documentation says that we can use only maximum of one worker with gunicorn when deploying flask socketio apps, sorry if iam wrong sir. If only one worker can be used maximum can we handle more than 10k concurrent users? Can we make it possible without load balancing sir? |
Beta Was this translation helpful? Give feedback.
-
@Gokul-44 I gave you the link to the section of the documentation that discusses multiple workers. The load balancer in Gunicorn is not flexible enough, so it cannot be used, you have to use a better load balancer, such as nginx. |
Beta Was this translation helpful? Give feedback.
-
How many users you can handle seems to depend on a lot of things, like what your server is doing and the resources of the machine it is running on. If the client is set to use websocket only, gunicorn with multiple workers should work though right? That seems to be what I've found running tests. |
Beta Was this translation helpful? Give feedback.
-
@bluthen Gunicorn with multiple workers still requires a message queue for coordination. Other than that yes, WebSocket connections work, but any client who attempts to connect in the default way will not be able to. |
Beta Was this translation helpful? Give feedback.
-
@miguelgrinberg okay sir. I don't know how to use message queue so can you give a example code sir? |
Beta Was this translation helpful? Give feedback.
-
@Gokul-44 There is documentation for all of this. |
Beta Was this translation helpful? Give feedback.
-
Sir I read about how to host flask socketio in production from the website. But I have a doubt that if the gunicorn can't increase the number of workers can we host a flask website with flasksocketio for more than 50k requests?
If using nginx can make it happen or any other way?
Beta Was this translation helpful? Give feedback.
All reactions