Skip to content

Commit

Permalink
更新:调整Worker数量,提高并发能力和响应速度
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuchunshu committed Feb 18, 2023
1 parent 6d4c3ab commit a8708fe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,6 @@ REDIS_AUTH=(null)
REDIS_PORT=6379
REDIS_DB=0

HASH_DRIVER=bcrypt
HASH_DRIVER=bcrypt

WORKER_NUM=3
2 changes: 1 addition & 1 deletion config/autoload/server.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
],
'settings' => [
Constant::OPTION_ENABLE_COROUTINE => true,
Constant::OPTION_WORKER_NUM => swoole_cpu_num(),
Constant::OPTION_WORKER_NUM => swoole_cpu_num() * (int) env('WORKER_NUM', 3) ?: 1,
Constant::OPTION_PID_FILE => BASE_PATH . '/runtime/hyperf.pid',
Constant::OPTION_OPEN_TCP_NODELAY => true,
Constant::OPTION_MAX_COROUTINE => 100000,
Expand Down

0 comments on commit a8708fe

Please sign in to comment.