Skip to content

Commit 9e334c5

Browse files
authored
[Python/Blacksheep] Adjust the number of single-process database connections in the pypy (#9936)
* Adjust the number of single-process database connections in the `pypy` environment. * fix error
1 parent f02224f commit 9e334c5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

frameworks/Python/blacksheep/app-socketify.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@
1313
WRITE_ROW_SQL = 'UPDATE "world" SET "randomnumber"=%s WHERE id=%s'
1414
ADDITIONAL_ROW = [0, "Additional fortune added at request time."]
1515
CORE_COUNT = multiprocessing.cpu_count()
16+
MAX_DB_CONNECTIONS = 2000
1617

17-
MAX_POOL_SIZE = CORE_COUNT * 2
18+
MAX_POOL_SIZE = min(CORE_COUNT * 2, MAX_DB_CONNECTIONS // CORE_COUNT, 32)
1819
MIN_POOL_SIZE = max(1, MAX_POOL_SIZE // 2)
1920
db_pool = None
2021

0 commit comments

Comments
 (0)