Skip to content

Commit b6b87e8

Browse files
authored
try optimization
1 parent 2bf2f97 commit b6b87e8

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

frameworks/Python/blacksheep/app-socketify.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,10 @@
1212
READ_ROW_SQL = 'SELECT "id", "randomnumber" FROM "world" WHERE id = %s'
1313
WRITE_ROW_SQL = 'UPDATE "world" SET "randomnumber"=%s WHERE id=%s'
1414
ADDITIONAL_ROW = [0, "Additional fortune added at request time."]
15-
MAX_CONNECTIONS = 200
15+
MAX_CONNECTIONS = 1000
1616
CORE_COUNT = multiprocessing.cpu_count()
17-
PROCESSES = CORE_COUNT
1817

19-
WORKER_PROCESSES = CORE_COUNT
20-
MAX_POOL_SIZE = CORE_COUNT * 2
18+
MAX_POOL_SIZE = (MAX_CONNECTIONS // CORE_COUNT)
2119
MIN_POOL_SIZE = max(1, MAX_POOL_SIZE // 2)
2220
db_pool = None
2321

frameworks/Python/blacksheep/app.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,9 @@
1919
ADDITIONAL_ROW = [0, "Additional fortune added at request time."]
2020
MAX_CONNECTIONS = 1900
2121
CORE_COUNT = multiprocessing.cpu_count()
22-
PROCESSES = CORE_COUNT
23-
MAX_POOL_SIZE = max(1,int(os.getenv('MAX_POOL_SIZE', MAX_CONNECTIONS // PROCESSES)))
22+
MAX_POOL_SIZE = max(1,int(os.getenv('MAX_POOL_SIZE', MAX_CONNECTIONS // CORE_COUNT)))
2423
MIN_POOL_SIZE = max(1,int(os.getenv('MIN_POOL_SIZE', MAX_POOL_SIZE // 2)))
2524

26-
WORKER_PROCESSES = CORE_COUNT
27-
MAX_POOL_SIZE = max(1, MAX_CONNECTIONS // WORKER_PROCESSES)
28-
MIN_POOL_SIZE = max(1, MAX_POOL_SIZE // 2)
2925
db_pool = None
3026

3127
async def setup_db(app):

0 commit comments

Comments
 (0)