You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tooling.apache.org by ak...@apache.org on 2026/06/05 07:37:42 UTC

(tooling-gofannon) 18/25: give dev actual multi-worker parallelism and lift couchdb's scheduler cap

This is an automated email from the ASF dual-hosted git repository.

andrewmusselman pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tooling-gofannon.git

commit 9a306f92d1dc0ac271975b403337c089b0212d75
Author: Andrew Musselman <ak...@apache.org>
AuthorDate: Fri Jun 5 03:58:17 2026 +0000

    give dev actual multi-worker parallelism and lift couchdb's scheduler cap
    
    Three changes to webapp/infra/docker/docker-compose.yml.
    
    1. Remove the api service's compose-level command override. The
       Dockerfile already has CMD [..., --workers, 4] which is what we
       want; the compose override was running uvicorn with --reload,
       which forces uvicorn into single-worker mode (you can't hot-reload
       across processes). Net effect of the override: 1 worker, not 4,
       regardless of what the Dockerfile said. When an agent's streaming
       endpoint pinned that single worker with sync CouchDB ops, every
       other request -- home page modules, /runs, anything -- queued
       behind it. Removing the override means the Dockerfile CMD runs
       and dev actually gets four workers.
    
       Tradeoff: lose hot-reload on .py edits in dev. Trying to keep
       both reload AND multi-worker requires an external watcher
       process (watchfiles/watchexec touching a sentinel file workers
       monitor) or moving to gunicorn with --reload-engine. Not worth
       the complexity right now -- if hot reload turns out to be missed
       often, we can layer it back.
    
    2. Drop ERL_FLAGS=+S 2:2 from the api service environment. Copy-
       paste from the couchdb service -- Erlang VM flags do nothing for
       the Python uvicorn process. Removing for cleanliness, no
       behavior change.
    
    3. Drop ERL_FLAGS=+S 2:2 from the couchdb service environment.
       This was capping CouchDB's Erlang scheduler to 2 schedulers + 2
       dirty schedulers, artificially serializing concurrent CouchDB
       requests to those threads regardless of how many CPU cores the
       container had access to. Without the flag, Erlang defaults to a
       scheduler per detected CPU core (typically 4-16 in a dev box).
       Concurrent reads from the four uvicorn workers can now actually
       run in parallel inside CouchDB instead of queueing at the
       scheduler level.
    
    Together with the existing async CouchDB shim, this is the dev-
    side throughput unblock: multi-worker FastAPI talking to a
    multi-scheduler CouchDB, with the read endpoints' sync calls
    offloaded to thread pools so the workers' event loops stay free
    for SSE streams and other concurrent traffic.
    
    Does NOT address the underlying per-key sequential write pattern
    in the asvs_* agents -- that's the next round of work and lives
    on the agent side, not the infra side.
---
 webapp/infra/docker/docker-compose.yml | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/webapp/infra/docker/docker-compose.yml b/webapp/infra/docker/docker-compose.yml
index 70f7c96..41f9465 100644
--- a/webapp/infra/docker/docker-compose.yml
+++ b/webapp/infra/docker/docker-compose.yml
@@ -39,7 +39,6 @@ services:
       - COUCHDB_URL=${COUCHDB_URL:-http://couchdb:5984/}
       - COUCHDB_USER=${COUCHDB_USER:-admin}
       - COUCHDB_PASSWORD=${COUCHDB_PASSWORD:-password}
-      - ERL_FLAGS=+S 2:2
       - AUTH_CONFIG_PATH=/auth-config/auth.yaml
     env_file:
       - ./.env
@@ -50,7 +49,6 @@ services:
         condition: service_started
     networks:
       - gofannon-net
-    command: uvicorn main:app --host 0.0.0.0 --port 8000 --reload --reload-exclude "*.pyc" --reload-exclude "__pycache__/*" --reload-exclude "tests/*" --reload-exclude ".pytest_cache/*" --reload-exclude "htmlcov/*" --reload-exclude "coverage.xml" --reload-exclude ".coverage"
 
   minio:
     image: minio/minio:RELEASE.2023-03-20T20-16-18Z
@@ -73,7 +71,6 @@ services:
     environment:
       - COUCHDB_USER=${COUCHDB_USER:-admin}
       - COUCHDB_PASSWORD=${COUCHDB_PASSWORD:-password}
-      - ERL_FLAGS=+S 2:2
     volumes:
       - couchdb-data:/opt/couchdb/data
     networks:


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tooling.apache.org
For additional commands, e-mail: commits-help@tooling.apache.org