fix: two API processes by default and the worker drains its queue
The API ran as one uvicorn process, so a slow 150 MB PDF check at checkout held every other request; WEB_CONCURRENCY now comes from API_WORKERS (default 2, 1 restores one process) and the api /tmp grows to 512 MiB for two checks at once. The worker delivered one outbox job per second; it now drains up to 50 per pass before its periodic tasks. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -213,13 +213,20 @@ services:
|
||||
|
||||
api:
|
||||
image: ${API_IMAGE:-gitea.blyzer.com.br/blyzer/dtf-api}:${IMAGE_TAG:-latest}
|
||||
environment: *app-environment
|
||||
environment:
|
||||
<<: *app-environment
|
||||
# Two uvicorn processes by default (Critical Corrections item 2, step 1):
|
||||
# a slow 150 MB PDF check no longer holds every request in the only one.
|
||||
# API_WORKERS=1 restores one process without a new image.
|
||||
WEB_CONCURRENCY: "${API_WORKERS:-2}"
|
||||
networks: [backend, egress]
|
||||
read_only: true
|
||||
# Swarm ignores the short `tmpfs:` key: a read-only container then has no
|
||||
# writable /tmp at all. The long volume syntax is what a stack honours.
|
||||
# 512 MiB, not 256: with two processes each may write a 150 MB PDF from the
|
||||
# grade check at the same time.
|
||||
volumes:
|
||||
- {type: tmpfs, target: /tmp, tmpfs: {size: 268435456}}
|
||||
- {type: tmpfs, target: /tmp, tmpfs: {size: 536870912}}
|
||||
healthcheck:
|
||||
test: [CMD-SHELL, 'python -c "import os,urllib.request; r=urllib.request.Request(\"http://localhost:8000/health\",headers={\"Host\":os.environ[\"PUBLIC_HOST\"]}); urllib.request.urlopen(r,timeout=3)"']
|
||||
interval: 15s
|
||||
|
||||
Reference in New Issue
Block a user