mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
Derive coroutine HTTP pool sizing
This commit is contained in:
@@ -1,10 +1,5 @@
|
||||
<?php
|
||||
|
||||
// Coroutine HTTP serves requests in a single long-lived process.
|
||||
putenv('_APP_POOL_PROCESS_COUNT=1');
|
||||
$_ENV['_APP_POOL_PROCESS_COUNT'] = '1';
|
||||
$_SERVER['_APP_POOL_PROCESS_COUNT'] = '1';
|
||||
|
||||
require_once __DIR__ . '/init.php';
|
||||
require_once __DIR__ . '/init/span.php';
|
||||
|
||||
|
||||
@@ -245,8 +245,11 @@ $register->set('pools', function () {
|
||||
$maxConnections = (int) System::getEnv('_APP_CONNECTIONS_MAX', 151);
|
||||
$instanceConnections = $maxConnections / (int) System::getEnv('_APP_POOL_CLIENTS', 14);
|
||||
|
||||
$scriptPath = \str_replace('\\', '/', (string) ($_SERVER['SCRIPT_FILENAME'] ?? ''));
|
||||
$isCoroutineHttp = \str_ends_with($scriptPath, '/app/http.php');
|
||||
|
||||
$workerCount = intval(System::getEnv('_APP_CPU_NUM', swoole_cpu_num())) * intval(System::getEnv('_APP_WORKER_PER_CORE', 6));
|
||||
$processCount = max(1, (int) System::getEnv('_APP_POOL_PROCESS_COUNT', (string) $workerCount));
|
||||
$processCount = $isCoroutineHttp ? 1 : $workerCount;
|
||||
$poolSize = max(1, (int)($instanceConnections / $processCount));
|
||||
|
||||
foreach ($connections as $key => $connection) {
|
||||
|
||||
Reference in New Issue
Block a user