From f88ffa1af00ada2598063206755aa12b5bb3ed5d Mon Sep 17 00:00:00 2001 From: shum Date: Fri, 21 Aug 2026 08:54:54 +0000 Subject: [PATCH] scripts: increase relay pool and queue size --- scripts/relay/.env.example | 4 ++++ scripts/relay/docker-compose.yaml | 5 ++++- scripts/relay/entrypoint.py | 4 ++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/scripts/relay/.env.example b/scripts/relay/.env.example index 7d9100378d..313446b516 100644 --- a/scripts/relay/.env.example +++ b/scripts/relay/.env.example @@ -12,3 +12,7 @@ CHAT_REF=88df79d1e26921c7d1835fc8484fade596356fb6 # GHC runtime options, without the +RTS/-RTS markers. #RELAY_RTS_OPTS="-N -F1.2 -A16m -I0.01 -Iw15" + +# Database connection pool and internal queue size. +#RELAY_POOL_SIZE=4 +#RELAY_QUEUE_SIZE=65536 diff --git a/scripts/relay/docker-compose.yaml b/scripts/relay/docker-compose.yaml index d6ffe4ffb6..9ccde75ee8 100644 --- a/scripts/relay/docker-compose.yaml +++ b/scripts/relay/docker-compose.yaml @@ -14,7 +14,10 @@ services: environment: RELAY_NAME: ${RELAY_NAME} RELAY_WEB_DOMAIN: ${RELAY_WEB_DOMAIN} - RELAY_RTS_OPTS: ${RELAY_RTS_OPTS:-} # empty: entrypoint default + # Empty values fall back to the entrypoint defaults. + RELAY_RTS_OPTS: ${RELAY_RTS_OPTS:-} + RELAY_POOL_SIZE: ${RELAY_POOL_SIZE:-} + RELAY_QUEUE_SIZE: ${RELAY_QUEUE_SIZE:-} # Password is passed as PGPASSWORD to keep it out of argv. DB_CONN: postgresql://${POSTGRES_USER}@db:5432/${POSTGRES_DB} PGPASSWORD: ${POSTGRES_PASSWORD} diff --git a/scripts/relay/entrypoint.py b/scripts/relay/entrypoint.py index a63d23d9ee..f8d715ba36 100755 --- a/scripts/relay/entrypoint.py +++ b/scripts/relay/entrypoint.py @@ -14,6 +14,8 @@ WEB_ROOT = "/var/www/relay-web-channels" ADDR_FILE = "/out/relay-address.txt" CAPTURE_TIMEOUT = 180 # seconds DEFAULT_RTS_OPTS = "-N -F1.2 -A16m -I0.01 -Iw15" +DEFAULT_POOL_SIZE = "4" # the binary defaults to a single connection +DEFAULT_QUEUE_SIZE = "65536" def require(name): @@ -88,6 +90,8 @@ def main(): "--relay-web-interval", "30", "-d", conn, "--create-schema", + "--pool-size", os.environ.get("RELAY_POOL_SIZE") or DEFAULT_POOL_SIZE, + "--queue-size", os.environ.get("RELAY_QUEUE_SIZE") or DEFAULT_QUEUE_SIZE, ] + rts_args() os.execvp(relay[0], relay)