]> git.proxmox.com Git - ceph.git/blame - ceph/doc/dev/perf_counters.rst
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / doc / dev / perf_counters.rst
CommitLineData
7c673cae
FG
1===============
2 Perf counters
3===============
4
5The perf counters provide generic internal infrastructure for gauges and counters. The counted values can be both integer and float. There is also an "average" type (normally float) that combines a sum and num counter which can be divided to provide an average.
6
7The intention is that this data will be collected and aggregated by a tool like ``collectd`` or ``statsd`` and fed into a tool like ``graphite`` for graphing and analysis.
8
9Access
10------
11
12The perf counter data is accessed via the admin socket. For example::
13
14 ceph daemon osd.0 perf schema
15 ceph daemon osd.0 perf dump
16
17
18Collections
19-----------
20
21The values are grouped into named collections, normally representing a subsystem or an instance of a subsystem. For example, the internal ``throttle`` mechanism reports statistics on how it is throttling, and each instance is named something like::
22
23
24 throttle-msgr_dispatch_throttler-hbserver
25 throttle-msgr_dispatch_throttler-client
26 throttle-filestore_bytes
27 ...
28
29
30Schema
31------
32
33The ``perf schema`` command dumps a json description of which values are available, and what their type is. Each named value as a ``type`` bitfield, with the following bits defined.
34
35+------+-------------------------------------+
36| bit | meaning |
37+======+=====================================+
38| 1 | floating point value |
39+------+-------------------------------------+
40| 2 | unsigned 64-bit integer value |
41+------+-------------------------------------+
42| 4 | average (sum + count pair) |
43+------+-------------------------------------+
44| 8 | counter (vs gauge) |
45+------+-------------------------------------+
46
47Every value will have either bit 1 or 2 set to indicate the type (float or integer). If bit 8 is set (counter), the reader may want to subtract off the previously read value to get the delta during the previous interval.
48
49If bit 4 is set (average), there will be two values to read, a sum and a count. If it is a counter, the average for the previous interval would be sum delta (since the previous read) divided by the count delta. Alternatively, dividing the values outright would provide the lifetime average value. Normally these are used to measure latencies (number of requests and a sum of request latencies), and the average for the previous interval is what is interesting.
50
51Here is an example of the schema output::
52
53 {
54 "throttle-msgr_dispatch_throttler-hbserver" : {
55 "get_or_fail_fail" : {
56 "type" : 10
57 },
58 "get_sum" : {
59 "type" : 10
60 },
61 "max" : {
62 "type" : 10
63 },
64 "put" : {
65 "type" : 10
66 },
67 "val" : {
68 "type" : 10
69 },
70 "take" : {
71 "type" : 10
72 },
73 "get_or_fail_success" : {
74 "type" : 10
75 },
76 "wait" : {
77 "type" : 5
78 },
79 "get" : {
80 "type" : 10
81 },
82 "take_sum" : {
83 "type" : 10
84 },
85 "put_sum" : {
86 "type" : 10
87 }
88 },
89 "throttle-msgr_dispatch_throttler-client" : {
90 "get_or_fail_fail" : {
91 "type" : 10
92 },
93 "get_sum" : {
94 "type" : 10
95 },
96 "max" : {
97 "type" : 10
98 },
99 "put" : {
100 "type" : 10
101 },
102 "val" : {
103 "type" : 10
104 },
105 "take" : {
106 "type" : 10
107 },
108 "get_or_fail_success" : {
109 "type" : 10
110 },
111 "wait" : {
112 "type" : 5
113 },
114 "get" : {
115 "type" : 10
116 },
117 "take_sum" : {
118 "type" : 10
119 },
120 "put_sum" : {
121 "type" : 10
122 }
123 }
124 }
125
126
127Dump
128----
129
130The actual dump is similar to the schema, except that average values are grouped. For example::
131
132 {
133 "throttle-msgr_dispatch_throttler-hbserver" : {
134 "get_or_fail_fail" : 0,
135 "get_sum" : 0,
136 "max" : 104857600,
137 "put" : 0,
138 "val" : 0,
139 "take" : 0,
140 "get_or_fail_success" : 0,
141 "wait" : {
142 "avgcount" : 0,
143 "sum" : 0
144 },
145 "get" : 0,
146 "take_sum" : 0,
147 "put_sum" : 0
148 },
149 "throttle-msgr_dispatch_throttler-client" : {
150 "get_or_fail_fail" : 0,
151 "get_sum" : 82760,
152 "max" : 104857600,
153 "put" : 2637,
154 "val" : 0,
155 "take" : 0,
156 "get_or_fail_success" : 0,
157 "wait" : {
158 "avgcount" : 0,
159 "sum" : 0
160 },
161 "get" : 2637,
162 "take_sum" : 0,
163 "put_sum" : 82760
164 }
165 }
166