Question

If I deploy Django using Gunicorn with the Eventlet worker type, and only use one process, what happens under the hood to service the 1000 (by default) worker connections? What parts of Django are copied into each thread? Are any parts copied?

Was it helpful?

Solution

If you set workers = 1 in your gunicorn configuration, two processes will be created: 1 master process and 1 worker process.

When you use worker_class = eventlet, the simultaneous connections are handled by green threads. Green threads are not like real threads. In simple terms, green threads are functions (coroutines) that yield whenever the function encounters I/O operation.

So nothing is copied. You just need to worry about making every I/O operation 'green'.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top