Move io_tests to folly/io/async/test
[hiphop-php.git] / hphp / doc / server.stats
blob7692356daf28bc19a74478098141bd0b110c7090
2 <h2>Server Stats</h2>
4 HHVM collects stats by time slots. Each time slot is configured as
5 StatsSlotDuration seconds and server internally keeps StatsMaxSlot number
6 of slots. Inside each slot, we keep a set of stats. These stats include
7 one built-in ("hit") and many key-value pairs defined by different parts
8 of the system.
10   slot:
11     time:
12     hit:   total counts
13     details:
14       key-value pair
15       key-value pair
16       key-value pair
17       ...
20 <h2>Stats Query</h2>
22 To query stats aggregated into one list of key value pairs encoded in JSON
23 format, hit admin port with a URL like this,
25   http://[server]:8088/stats.kvp?keys=...&to=[t2]...
27 keys: (optional) comma delimited keys to query, each of which can be decorated
28         [key]      just the key's value, e.g. "sql.conn"
29         [key]/hit  average per page hit, e.g. "sql.conn/hit"
30         [key]/sec  per second rate, e.g. "sql.conn/sec"
31         #[regex]#  keys matching the regular expression
32         (omitted)  all available keys
34 prefix: (optional) adds a prefix and '.' delimiter to all key names
37 <h2>Available Keys</h2>
39 1. SQL Stats:
41 (1) Connections
43 sql.conn:       number of connections newly created
44 sql.reconn_new: number of connections newly created when trying to reconnect
45 sql.reconn_ok:  number of connections re-picked up when trying to reconnect
46 sql.reconn_old: number of connections dropped when trying to reconnect
48 (2) Queries
50 sql.query:                number of queries executed
51 sql.query.[table].[verb]: per table-verb stats
52 sql.query.[verb]:         per verb stats, where [verb] can be one of these:
54 - select
55 - insert
56 - update
57 - replace
58 - delete
59 - begin
60 - commit
61 - rollback
62 - unknown
64 2. MemCache Stats:
66 mcc.madd:           number of multi_add() calls
67 mcc.madd.count:     total count of multi added keys
68 mcc.mreplace:       number of multi_replace() calls
69 mcc.mreplace.count: total count of multi replaced keys
70 mcc.set:            number of set() calls
71 mcc.add:            number of add() calls
72 mcc.decr:           number of decr() calls
73 mcc.incr:           number of incr() calls
74 mcc.delete:         number of delete() calls
75 mcc.delete_details: number of delete_details() calls
76 mcc.get:            number of get() calls
77 mcc.mget:           number of multi_get() calls
78 mcc.mget.count:     total count of multi got keys
79 mcc.replace:        number of replace() calls
80 mcc.set:            number of set() calls
81 mcc.stats:          number of stats() calls
83 3. APC Stats:
85 apc.miss:   number of item misses
86 apc.hit:    number of item hits
87 apc.write:  number of writes
89 4. Memory Stats:
91 These two stats are only available when Google heap profler is turned on for
92 debugging purposes:
94 mem.malloc.peak:   peak malloc()-ed memory
95 mem.malloc.leaked: leaked malloc()-ed memory
97 5. Page Sections:
99 page.wall.[section]:   wall time a page section takes
100 page.cpu.[section]:    CPU time a page section takes
101 mem.[section]:         request-local memory that a page section takes
102 network.uncompressed:  total bytes to be sent before compression
103 network.compressed:    total bytes sent after compression
105 Section can be one of these:
107 - queuing
108 - all
109 - input
110 - invoke
111 - send
112 - psp
113 - rollback
114 - free
116 6. evhttp Stats:
118 - evhttp.hit              used cached connection
119 - evhttp.hit.[address]    used cached connection by URL
120 - evhttp.miss             no cached connection available
121 - evhttp.miss.[address]   no cached connection available by URL
122 - evhttp.close            cached connection got closed
123 - evhttp.close.[address]  cached connection got closed by URL
124 - evhttp.skip             not set to use cached connection
125 - evhttp.skip.[address]   not set to use cached connection by URL
127 7. Application Stats:
129 PHP page can collect application-defined stats by calling
131   hphp_stats($key, $count);
133 where $key is arbitrary and $count will be tallied across different calls of
134 the same key.
136 8. Special Keys:
138 hit:   page hit
139 load:  number of active worker threads
140 idle:  number of idle worker threads
143 <h2>Example URL</h2>
145   GET "http://localhost:8088/stats.kvp?prefix=hphp" \
146     "&keys=apc.hit/sec,hit,load,:sql.query..*.select:," \
147     "network.compressed/hit,hit/sec"
149 This URL queries the following data:
151 hit:                        page hits
152 hit/sec:                    request per second
153 apc.hit/sec:                APC hit per second
154 load:                       number of active threads currently
155 network.compressed/hit:     sent bytes per request
156 :sql.query..*.select:       all SELECTs on different tables