12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- <?php
- declare(strict_types=1);
- /**
- * This file is part of Hyperf.
- *
- * @link https://www.hyperf.io
- * @document https://doc.hyperf.io
- * @contact [email protected]
- * @license https://github.com/hyperf-cloud/hyperf/blob/master/LICENSE
- */
- use Hyperf\Server\Server;
- use Hyperf\Server\SwooleEvent;
- return [
- 'mode' => SWOOLE_BASE,
- 'servers' => [
- [
- 'name' => 'http',
- 'type' => Server::SERVER_HTTP,
- 'host' => '0.0.0.0',
- 'port' => 9501,
- 'sock_type' => SWOOLE_SOCK_TCP,
- 'callbacks' => [
- SwooleEvent::ON_REQUEST => [Hyperf\HttpServer\Server::class, 'onRequest'],
- ],
- ],
- ],
- 'settings' => [
- 'enable_coroutine' => true,
- 'reactor_num' => swoole_cpu_num() * 2,
- 'worker_num' => swoole_cpu_num(),
- 'task_worker_num' => swoole_cpu_num(),
- 'pid_file' => BASE_PATH . '/runtime/hyperf.pid',
- 'open_tcp_nodelay' => true,
- 'open_cpu_affinity' => true,
- 'max_connection' => 100000,
- 'log_level' => SWOOLE_LOG_NONE,
- ],
- 'callbacks' => [
- SwooleEvent::ON_BEFORE_START => [Hyperf\Framework\Bootstrap\ServerStartCallback::class, 'beforeStart'],
- SwooleEvent::ON_WORKER_START => [Hyperf\Framework\Bootstrap\WorkerStartCallback::class, 'onWorkerStart'],
- SwooleEvent::ON_PIPE_MESSAGE => [Hyperf\Framework\Bootstrap\PipeMessageCallback::class, 'onPipeMessage'],
- // Task callbacks
- SwooleEvent::ON_TASK => [Hyperf\Framework\Bootstrap\TaskCallback::class, 'onTask'],
- SwooleEvent::ON_FINISH => [Hyperf\Framework\Bootstrap\FinishCallback::class, 'onFinish'],
- ],
- ];
|