Skip to content

Commit 91bd0d3

Browse files
committed
Set the number of processes to be equal to the number of CPU cores.
1 parent fd31010 commit 91bd0d3

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

php/swoole/public/index.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66

77
$server = new Server('0.0.0.0', 3000, SWOOLE_BASE);
88
$server->set([
9-
'worker_num' => swoole_cpu_num() * 2,
10-
'log_level' => SWOOLE_LOG_ERROR,
11-
'log_file' => '/dev/null',
12-
'enable_coroutine' => false,
9+
'worker_num' => swoole_cpu_num(),
10+
'log_level' => SWOOLE_LOG_ERROR,
11+
'log_file' => '/dev/null',
12+
'enable_coroutine' => false,
13+
'enable_reuse_port' => true,
1314
]);
1415
$server->on('request', function (Request $request, Response $response) {
1516
$uri = $request->server['request_uri'] ?? '/';

0 commit comments

Comments
 (0)