Skip to content

Custom Thread Pool

Django Cheroot exposes Cheroot’s thread-pool controls directly, so you can size the server for your workload without touching Python.

To make the server reachable from outside the local machine (for example inside a container), bind to all interfaces:

Terminal window
python manage.py cheroot --hostip 0.0.0.0 --port 8080

For a busier app, grow the pool and the connection backlog:

Terminal window
python manage.py cheroot \
--hostip 0.0.0.0 \
--port 8080 \
--minthreads 50 \
--maxthreads 100 \
--connections 50

What each flag does:

  • --minthreads 50 keeps 50 worker threads warm so traffic spikes don’t pay thread-startup cost.
  • --maxthreads 100 lets the pool grow to 100 threads under sustained concurrency.
  • --connections 50 widens the accept backlog so bursts of new connections queue instead of being refused.

For a mostly-idle internal service, keep the pool small:

Terminal window
python manage.py cheroot -t 4 -w 16 -c 10