swoole.php 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <?php
  2. use app\webscoket\Manager;
  3. return [
  4. 'http' => [
  5. 'enable' => true,
  6. 'host' => '0.0.0.0',
  7. 'port' => 21969,
  8. 'worker_num' => swoole_cpu_num() * 2,
  9. 'options' => [
  10. 'package_max_length' => 50 * 1024 * 1024,
  11. ],
  12. ],
  13. 'websocket' => [
  14. 'enable' => true,
  15. 'handler' => Manager::class,
  16. 'ping_interval' => 25000,
  17. 'ping_timeout' => 60000,
  18. 'room' => [
  19. 'type' => 'table',
  20. 'table' => [
  21. 'room_rows' => 8192,
  22. 'room_size' => 2048,
  23. 'client_rows' => 4096,
  24. 'client_size' => 2048,
  25. ],
  26. 'redis' => [
  27. 'host' => '127.0.0.1',
  28. 'port' => 6379,
  29. 'max_active' => 3,
  30. 'max_wait_time' => 5,
  31. ],
  32. ],
  33. 'listen' => [],
  34. 'subscribe' => [],
  35. ],
  36. 'rpc' => [
  37. 'server' => [
  38. 'enable' => false,
  39. 'host' => '0.0.0.0',
  40. 'port' => 9000,
  41. 'worker_num' => swoole_cpu_num(),
  42. 'services' => [],
  43. ],
  44. 'client' => [],
  45. ],
  46. //队列
  47. 'queue' => [
  48. 'enable' => true,
  49. 'workers' => [
  50. 'qiniu_queue' => [],
  51. 'qiniu_batch' => [],
  52. 'qiniu_admin_log' => [],
  53. ],
  54. ],
  55. 'hot_update' => [
  56. 'enable' => env('APP_DEBUG', false),
  57. 'name' => ['*.php'],
  58. 'include' => [app_path(), root_path('qiniu')],
  59. 'exclude' => [],
  60. ],
  61. //连接池
  62. 'pool' => [
  63. 'db' => [
  64. 'enable' => true,
  65. 'max_active' => swoole_cpu_num() * 4,
  66. 'max_wait_time' => 5,
  67. ],
  68. 'cache' => [
  69. 'enable' => true,
  70. 'max_active' => 30,
  71. 'max_wait_time' => 5,
  72. ],
  73. //自定义连接池
  74. ],
  75. 'ipc' => [
  76. 'type' => 'unix_socket',
  77. 'redis' => [
  78. 'host' => '127.0.0.1',
  79. 'port' => 6379,
  80. 'max_active' => 3,
  81. 'max_wait_time' => 5,
  82. ],
  83. ],
  84. 'tables' => [],
  85. //每个worker里需要预加载以共用的实例
  86. 'concretes' => [],
  87. //重置器
  88. 'resetters' => [],
  89. //每次请求前需要清空的实例
  90. 'instances' => [],
  91. //每次请求前需要重新执行的服务
  92. 'services' => [],
  93. ];