Performance: Gunicorn as WSGI server
Gunicorn affects how quickly your Django app starts handling requests and manages concurrent users, impacting server response time and throughput.
Jump into concepts and practice - no test required
gunicorn myproject.wsgi:application --workers 3 --threads 2
gunicorn myproject.wsgi:application --workers 1 --threads 1
| Pattern | Concurrent Requests | Response Latency | CPU Utilization | Verdict |
|---|---|---|---|---|
| Single worker, single thread | 1 at a time | High under load | Low CPU usage | [X] Bad |
| Multiple workers, multiple threads | Many in parallel | Low | Efficient CPU usage | [OK] Good |
myproject with the default WSGI application?projectname.wsgi:application.gunicorn myproject.wsgi:application.gunicorn --workers 3 --bind 0.0.0.0:8000 myproject.wsgi:application, what will happen when you run it?gunicorn myproject.wsgi:application --workers two and get an error. What is the likely cause?--workers 4.0.0.0.0:8080 makes the app accessible on port 8080 from any network interface.myproject.wsgi:application is the correct WSGI app for Django.