Swoole Server stats

Declaration

<?php
Swoole\Server->stats(): array

Parameters

none

Return

success

If success, it returns an array of data, otherwise it returns false.

Description

Get the TCP connections statistics of the current active server.

Example

The array of connections statistics of the current server:

<?php

array(14) {
  ["start_time"]=>
  int(1604969791)              // The time of server since start
  ["connection_num"]=>         
  int(1)                       // The number of current connections 
  ["accept_count"]=>
  int(1)                       // The number of connections accepted
  ["close_count"]=>
  int(0)                       // The number of connections closed
  ["worker_num"]=>
  int(1)                       // How many worker processes are started
  ["idle_worker_num"]=>
  int(0)                       // Number of idle worker processes
  ["task_worker_num"]=>
  int(1)                       // How many task_worker processes are started
  ["task_queue_num"]=>
  int(10)                      // The number of task which is in queue of task
  ["task_queue_bytes"]=>
  int(65536)                   // The number of bytes occupied by the memory of the message queue [for Task]
  ["tasking_num"]=>
  int(0)                       // The number of task which is queuing up
  ["request_count"]=>
  int(0)                       // The number of request received
  ["dispatch_count"]=>
  int(1)                       // The number of packages sent by Server to Worker [only valid in SWOOLE_PROCESS mode]
  ["worker_request_count"]=>
  int(0)                       // The number of request received by the current worker
  ["worker_dispatch_count"]=>
  int(1)                       // The count of tasks delivered by the master process to the current Worker process, and the count is increased when the master process dispatches
  ["task_idle_worker_num"]=>
  int(1)                      // Number of idle task processes
  ["coroutine_num"]=>
  int(1)                      // The current number of coroutines
}