[Fixed]-How many concurrent connections can django-channels handle?

7👍

ASGI (Asynchronous Server Gateway Interface) is intended to provide a standard interface between async-capable Python web servers, frameworks, and applications.

In Django Channels, even though Django itself in a synchronous mode it can handle connections and sockets asynchronously.

Websockets go into a server called Daphne (Daphne is a HTTP, HTTP2 and WebSocket protocol server for ASGI and ASGI-HTTP, developed to power Django Channels) can handle hundreds or potentially thousands of simultaneous connections open at once.

Any event on a websocket (connect, message received) is sent onto the channel layer, which is a type of first-in-first-out queue

Django worker processes synchronously take a message from the queue, process it, and then loop back to take another.

So, the number of open connections affects how many Daphne instances you run. And throughput of events affects the number of workers you run.

👤psorab

Leave a comment