You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.4 KiB

5 years ago
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * This file is part of Hyperf.
  5. *
  6. * @link https://www.hyperf.io
  7. * @document https://doc.hyperf.io
  8. * @contact group@hyperf.io
  9. * @license https://github.com/hyperf/hyperf/blob/master/LICENSE
  10. */
  11. use Hyperf\Server\Server;
  12. use Hyperf\Server\SwooleEvent;
  13. return [
  14. 'mode' => SWOOLE_PROCESS,
  15. 'servers' => [
  16. [
  17. 'name' => 'http',
  18. 'type' => Server::SERVER_HTTP,
  19. 'host' => '0.0.0.0',
  20. 'port' => 9501,
  21. 'sock_type' => SWOOLE_SOCK_TCP,
  22. 'callbacks' => [
  23. SwooleEvent::ON_REQUEST => [Hyperf\HttpServer\Server::class, 'onRequest'],
  24. ],
  25. ],
  26. ],
  27. 'settings' => [
  28. 'enable_coroutine' => true,
  29. 'worker_num' => swoole_cpu_num(),
  30. 'pid_file' => BASE_PATH . '/runtime/hyperf.pid',
  31. 'open_tcp_nodelay' => true,
  32. 'max_coroutine' => 100000,
  33. 'open_http2_protocol' => true,
  34. 'max_request' => 100000,
  35. 'socket_buffer_size' => 2 * 1024 * 1024,
  36. 'buffer_output_size' => 2 * 1024 * 1024,
  37. ],
  38. 'callbacks' => [
  39. SwooleEvent::ON_WORKER_START => [Hyperf\Framework\Bootstrap\WorkerStartCallback::class, 'onWorkerStart'],
  40. SwooleEvent::ON_PIPE_MESSAGE => [Hyperf\Framework\Bootstrap\PipeMessageCallback::class, 'onPipeMessage'],
  41. SwooleEvent::ON_WORKER_EXIT => [Hyperf\Framework\Bootstrap\WorkerExitCallback::class, 'onWorkerExit'],
  42. ],
  43. ];