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.

59 lines
2.0 KiB

5 years ago
5 years ago
5 years ago
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. 'name' => 'jsonrpc-http',
  28. 'type' => Server::SERVER_HTTP,
  29. 'host' => '0.0.0.0',
  30. 'port' => 9505,
  31. 'sock_type' => SWOOLE_SOCK_TCP,
  32. 'callbacks' => [
  33. SwooleEvent::ON_REQUEST => [\Hyperf\JsonRpc\HttpServer::class, 'onRequest'],
  34. ],
  35. ],
  36. ],
  37. 'settings' => [
  38. 'enable_coroutine' => true,
  39. 'worker_num' => swoole_cpu_num(),
  40. 'pid_file' => BASE_PATH . '/runtime/hyperf.pid',
  41. 'open_tcp_nodelay' => true,
  42. 'max_coroutine' => 100000,
  43. 'open_http2_protocol' => true,
  44. 'max_request' => 100000,
  45. 'socket_buffer_size' => 2 * 1024 * 1024,
  46. 'buffer_output_size' => 2 * 1024 * 1024,
  47. 'task_worker_num' => 8,
  48. 'task_enable_coroutine' => false,
  49. ],
  50. 'callbacks' => [
  51. SwooleEvent::ON_WORKER_START => [Hyperf\Framework\Bootstrap\WorkerStartCallback::class, 'onWorkerStart'],
  52. SwooleEvent::ON_PIPE_MESSAGE => [Hyperf\Framework\Bootstrap\PipeMessageCallback::class, 'onPipeMessage'],
  53. SwooleEvent::ON_WORKER_EXIT => [Hyperf\Framework\Bootstrap\WorkerExitCallback::class, 'onWorkerExit'],
  54. SwooleEvent::ON_TASK => [Hyperf\Framework\Bootstrap\TaskCallback::class, 'onTask'],
  55. SwooleEvent::ON_FINISH => [Hyperf\Framework\Bootstrap\FinishCallback::class, 'onFinish'],
  56. ],
  57. ];