From 3988be092c0786edfad85fa95c474e37cd976bdc Mon Sep 17 00:00:00 2001 From: JasonWildMe Date: Wed, 15 Jul 2026 15:31:29 -0700 Subject: [PATCH] fix: default prod compose to 1 uvicorn worker per GPU Each extra worker loads a full copy of all five models into the same GPU's VRAM (OOM risk). The README and dev compose already document 1 as the default; prod at 4 was the outlier. WORKERS in .env still overrides. For more throughput, run another service instance with a distinct GPU_ID rather than raising WORKERS. Carved out of #26 as an atomic change. Co-Authored-By: Claude Fable 5 --- docker/docker-compose.prod.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docker/docker-compose.prod.yml b/docker/docker-compose.prod.yml index 79740e1..062f2e1 100644 --- a/docker/docker-compose.prod.yml +++ b/docker/docker-compose.prod.yml @@ -17,7 +17,11 @@ services: - ultralytics_config:/root/.config/Ultralytics environment: - PYTHONPATH=/app - command: python3 -m app.main --host 0.0.0.0 --port 6050 --device ${DEVICE:-cuda} --workers ${WORKERS:-4} + # One worker per GPU: extra workers each load a full copy of all models + # into the same GPU's VRAM (OOM risk). For more throughput, add a separately + # named service with distinct GPU_ID, container name, and host port rather + # than raising WORKERS. + command: python3 -m app.main --host 0.0.0.0 --port 6050 --device ${DEVICE:-cuda} --workers ${WORKERS:-1} deploy: resources: reservations: