Skip to content

Commit 029d919

Browse files
committed
[aiohttp] - lower connection pool value
1 parent 6d87e55 commit 029d919

File tree

1 file changed

+4
-4
lines changed
  • frameworks/Python/aiohttp/app

1 file changed

+4
-4
lines changed

frameworks/Python/aiohttp/app/main.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ def pg_dsn(dialect=None) -> str:
4949
async def db_ctx(app: web.Application):
5050
# number of gunicorn workers = multiprocessing.cpu_count() as per gunicorn_conf.py
5151
# max_connections = 2000 as per toolset/setup/linux/databases/postgresql/postgresql.conf:64
52-
# give 10% leeway
53-
max_size = min(1800 / multiprocessing.cpu_count(), 160)
54-
max_size = max(int(max_size), 1)
55-
min_size = max(int(max_size / 2), 1)
52+
# but we have only 10k rows in the world table, so we must use a small connection pool
53+
# also target machine has 56 cores
54+
max_size = 3
55+
min_size = 3
5656
print(f'connection pool: min size: {min_size}, max size: {max_size}, orm: {CONNECTION_ORM}')
5757
if CONNECTION_ORM:
5858
dsn = pg_dsn('asyncpg')

0 commit comments

Comments
 (0)