[ALERT] Serve gunicorn with threaded workers so bad clients cannot starve the UI

Untrusting or half-deployed agents that fail the TLS handshake retry in a loop. With 4 blocking sync workers a few of them pinned every worker, and real UI requests queued for 20+ seconds while CPU sat idle. Switch to gthread (4 workers x 8 threads) and drop the timeout to 30s so a stuck connection frees its thread quickly and one misbehaving client cannot exhaust request capacity.
This commit is contained in:
benjamin.baker
2026-09-03 12:36:28 -04:00
parent 17825ec8f1
commit db75ca79d1

View File

@@ -79,10 +79,19 @@ services:
- gunicorn
- --bind
- 0.0.0.0:5001
# Threaded workers so one blocked request (e.g. an agent that fails the TLS
# handshake and retries in a loop) cannot pin a whole worker and starve the
# UI. With sync workers a handful of stuck clients exhausted all capacity.
- --worker-class
- gthread
- --workers
- "4"
- --threads
- "8"
# Shorter timeout so a hung connection frees its thread quickly instead of
# holding it for a full minute.
- --timeout
- "60"
- "30"
- --access-logfile
- "-"
- --error-logfile