File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
frameworks/Python/aiohttp/app Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -49,10 +49,11 @@ def pg_dsn(dialect=None) -> str:
49
49
async def db_ctx (app : web .Application ):
50
50
# number of gunicorn workers = multiprocessing.cpu_count() as per gunicorn_conf.py
51
51
# 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
+ # since the world table contains only 10,000 rows, a large connection pool is unnecessary
53
+ # the server hardware provides 56 CPU cores producing high concurrency
54
+ # https://wiki.postgresql.org/wiki/Number_Of_Database_Connections
55
+ max_size = 2
56
+ min_size = 2
56
57
print (f'connection pool: min size: { min_size } , max size: { max_size } , orm: { CONNECTION_ORM } ' )
57
58
if CONNECTION_ORM :
58
59
dsn = pg_dsn ('asyncpg' )
You can’t perform that action at this time.
0 commit comments