Ns server

From AOLserver Wiki
Jump to: navigation, search

Man page: http://aolserver.com/docs/tcl/ns_server.html


NAME

ns_server - Get state of the server's connection pools and queues

SYNOPSIS

ns_server option ?pool?

DESCRIPTION

This command provides a way to examine the current server's connection pools and queues. In AOLserver 4.0, if the optional pool name is omitted, data is returned for the "unnamed" connection pool for this virtual server. In AOLserver 4.5, the pool named "default" will be used. In AOLserver 4.5 connection pools are shared by all virtual servers.
The legal options (which may be abbreviated) are:
  • ns_server active ?pool?
  • ns_server all ?pool?
  • ns_server queued ?pool?
The above three options return a list of just active (i.e. running), all, or just queued conn threads with each running thread a 7-element list of {conn id, peeraddr, state, method, url, running time, bytes sent}, where state is either "running" or "queued".
Note that running time is returned in seconds.microseconds format which is misleading because 0.100 does not mean a tenth of a second, it means 100 microseconds.
  • ns_server connections ?pool?
returns the number of connection requests processed by this pool since startup. In AOLserver 4.5, this is currently broken and it returns the number of current connection threads (i.e. running + idle). Use ns_pools get to obtain this number - it will be listed under queued. To get the number for just a given virtual server, use ns_driver query servername/nssock.
  • ns_server keepalive ?pool?
currently unimplemented, always returns 0, is presumably meant to return the number of connections in keepalive state
  • ns_server pools ?pattern?
returns the list of pools defined for this virtual server in AOLserver 4.0 and this process in AOLserver 4.5, optionally matching glob patternin pattern. If no user pools are defined, returns {} in 4.0 and "default error" in 4.5
  • ns_server threads ?pool?
returns a list of key-value pairs (a keyed list) identifying the number of connection threads and what state they are currently in (min(threads), max(threads), current, idle and stopping). In both 4.0 and 4.5, stopping is always 0. current is the total number of conn threads currently running or idling
  • ns_server waiting ?pool?
returns the number of connections waiting to be processed

NOTES

See Bug #745784 -- ns_server is not safe under load because: "The problem is either the connPtr or some of the data buried in the conn can be changing in the running connection thread. I wouldn't suggest this be fixed because it could complicate the code and introduce a performance problem."
In AOLserver 4.5, a thread race condition which could lead to a crash when using "ns_server threads" has been fixed.


EXAMPLES

   % ns_server threads
   {min 0} {max 10} {current 0} {idle 0} {stopping 0}
   % ns_server all
   {3536 192.168.0.1 running GET /_stats 0.15624 0}

SEE ALSO

ns_pools, ns_info

-