From 98980590d707039165a200e0f6804d1075ace340 Mon Sep 17 00:00:00 2001 From: Vitor Hugo Salgado <2922948+vitorsalgado@users.noreply.github.com> Date: Wed, 6 Mar 2024 13:13:00 +0100 Subject: [PATCH] test: +pool size --- docker-compose.yml | 4 +++- src/index.js | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 5d0efe2..3e51af8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,6 +9,7 @@ services: network_mode: host environment: - DB_CONNECTION_STRING=postgresql://rinha:rinha@0.0.0.0:6432/rinha?sslmode=disable + - DB_POOL_SIZE=10 - ADDR=8081 - NODE_ENV=production - UV_THREADPOOL_SIZE=1 @@ -28,6 +29,7 @@ services: network_mode: host environment: - DB_CONNECTION_STRING=postgresql://rinha:rinha@0.0.0.0:6432/rinha?sslmode=disable + - DB_POOL_SIZE=10 - ADDR=8082 - NODE_ENV=production - UV_THREADPOOL_SIZE=1 @@ -84,7 +86,7 @@ services: dockerfile: Dockerfile.bouncer container_name: bouncer environment: - PGB_DATABASES: rinha = host=0.0.0.0 port=5432 pool_mode=statement pool_size=20 + PGB_DATABASES: rinha = host=0.0.0.0 port=5432 pool_mode=statement pool_size=30 PGB_ADMIN_USERS: rinha PGB_ADMIN_PASSWORDS: rinha network_mode: host diff --git a/src/index.js b/src/index.js index 4202354..913de8c 100644 --- a/src/index.js +++ b/src/index.js @@ -6,6 +6,7 @@ const { Pool } = native import fastJson from 'fast-json-stringify' const DbConnectionString = process.env.DB_CONNECTION_STRING ?? 'postgresql://rinha:rinha@0.0.0.0:5432/rinha?sslmode=disable' +const DbPoolSize = process.env.DB_POOL_SIZE ?? 5 const Addr = process.env.ADDR ?? 8080 const Clientes = new Map() @@ -17,7 +18,7 @@ const Clientes = new Map() const pool = new Pool({ connectionString: DbConnectionString, - max: 5, + max: DbPoolSize, connectionTimeoutMillis: 5 * 1000 })