注意
本文档适用于 Ceph 开发版本。
性能计数器
性能计数器为仪表和计数器提供通用的内部基础设施。计数值可以是整数和浮点数。还有一个“平均值”类型(通常是浮点数),它结合了总和和数量计数器,可以将其除以提供平均值。
目的是让这些数据被像collectd
或statsd
这样的工具收集和聚合,并输入到像graphite
这样的工具中进行图形化和分析。另外,请注意Prometheus 模块和遥测模块.
用户和开发者也可以本地访问性能计数器数据,以检查集群的整体健康状况、识别工作负载模式、按守护进程类型监控集群性能,以及排查延迟、限流、内存管理等问题的故障(参见访问)
访问
性能计数器数据通过管理套接字访问。例如:
ceph daemon osd.0 perf schema
ceph daemon osd.0 perf dump
收集
这些值被分组到命名的集合中,通常表示一个子系统或子系统的一个实例。例如,内部throttle
机制报告其限流机制的统计数据,并且每个实例的名称类似于:
throttle-msgr_dispatch_throttler-hbserver
throttle-msgr_dispatch_throttler-client
throttle-filestore_bytes
...
模式
The perf schema
命令导出一个JSON描述,说明哪些值可用,以及它们的类型。每个命名的值都有一个type
位域,定义了以下位。
bit |
含义 |
---|---|
1 |
浮点值 |
2 |
无符号64位整数值 |
4 |
平均值(总和 + 计数对),其中 |
8 |
计数器(与度量值) |
每个值将设置位1或2中的一个来指示类型(浮点数或整数)。
如果位8被设置(计数器),则该值是单调递增的,读者可能需要减去先前读取的值以获取前一个间隔的增量。
如果位4被设置(平均值),则将读取两个值,一个总和和一个计数。如果是计数器,前一个间隔的平均值将是自上次读取以来的总和增量除以计数增量。或者,直接除以这些值将提供生命周期平均值。通常这些用于测量延迟(请求数量和请求延迟的总和),而前一个间隔的平均值才是有趣的。
与解释位域相反,该metric type
属性的值是gauge
或counter
和value type
其中之一real
, integer
, real-integer-pair
(对于总和 + 实际计数对),或integer-integer-pair
(对于
以下是一个模式输出的示例:
{
"throttle-bluestore_throttle_bytes": {
"val": {
"type": 2,
"metric_type": "gauge",
"value_type": "integer",
"description": "Currently available throttle",
"nick": ""
},
"max": {
"type": 2,
"metric_type": "gauge",
"value_type": "integer",
"description": "Max value for throttle",
"nick": ""
},
"get_started": {
"type": 10,
"metric_type": "counter",
"value_type": "integer",
"description": "Number of get calls, increased before wait",
"nick": ""
},
"get": {
"type": 10,
"metric_type": "counter",
"value_type": "integer",
"description": "Gets",
"nick": ""
},
"get_sum": {
"type": 10,
"metric_type": "counter",
"value_type": "integer",
"description": "Got data",
"nick": ""
},
"get_or_fail_fail": {
"type": 10,
"metric_type": "counter",
"value_type": "integer",
"description": "Get blocked during get_or_fail",
"nick": ""
},
"get_or_fail_success": {
"type": 10,
"metric_type": "counter",
"value_type": "integer",
"description": "Successful get during get_or_fail",
"nick": ""
},
"take": {
"type": 10,
"metric_type": "counter",
"value_type": "integer",
"description": "Takes",
"nick": ""
},
"take_sum": {
"type": 10,
"metric_type": "counter",
"value_type": "integer",
"description": "Taken data",
"nick": ""
},
"put": {
"type": 10,
"metric_type": "counter",
"value_type": "integer",
"description": "Puts",
"nick": ""
},
"put_sum": {
"type": 10,
"metric_type": "counter",
"value_type": "integer",
"description": "Put data",
"nick": ""
},
"wait": {
"type": 5,
"metric_type": "gauge",
"value_type": "real-integer-pair",
"description": "Waiting latency",
"nick": ""
}
}
导出
实际转储类似于模式,只是平均值被分组。例如:
{
"throttle-msgr_dispatch_throttler-hbserver" : {
"get_or_fail_fail" : 0,
"get_sum" : 0,
"max" : 104857600,
"put" : 0,
"val" : 0,
"take" : 0,
"get_or_fail_success" : 0,
"wait" : {
"avgcount" : 0,
"sum" : 0
},
"get" : 0,
"take_sum" : 0,
"put_sum" : 0
},
"throttle-msgr_dispatch_throttler-client" : {
"get_or_fail_fail" : 0,
"get_sum" : 82760,
"max" : 104857600,
"put" : 2637,
"val" : 0,
"take" : 0,
"get_or_fail_success" : 0,
"wait" : {
"avgcount" : 0,
"sum" : 0
},
"get" : 2637,
"take_sum" : 0,
"put_sum" : 82760
}
}
标记性能计数器
Note
标记的性能计数器在Ceph的Reef版本中引入。
Ceph守护进程有能力发出一组带有不同标签的性能计数器实例。这些计数器旨在用于在Prometheus和Grafana等第三方工具中可视化特定指标。
例如,下面的计数器显示了不同用户在不同桶上的put请求数量:
{
"rgw": [
{
"labels": {
"Bucket: "bkt1",
"User: "user1",
},
"counters": {
"put": 1,
},
},
{
"labels": {},
"counters": {
"put": 4,
},
},
{
"labels": {
"Bucket: "bkt1",
"User: "user2",
},
"counters": {
"put": 3,
},
},
]
}
所有标记的和未标记的性能计数器都可以使用ceph daemon {daemon id} counter dump
.
所有标记的和未标记的性能计数器的模式都可以使用ceph daemon {daemon id} counter schema
.
在上面的示例中,第二个没有标签的计数器是一个在ceph daemon {daemon id} perf dump
.
由于 05c6a2 发散 c46404 事件没有记录在其他来自 a035fa 的日志中,它们没有被确认给客户端,丢弃它们没有害处(以便所有 OSD 都同意 c76d21 权威历史 83fd3b)。但是,我们将不得不指示任何存储来自发散更新的数据的 OSD 删除受影响的(现在被认为是无稽之谈的)对象。counter dump
和counter schema
命令可以用来查看这两种类型的计数器,但不建议使用perf dump
和perf schema
命令,这些命令保留以向后兼容,并继续只发出未标记的计数器。
一些通过perf dump
和perf schema
发出的性能计数器在未来版本中可能会变成标记的,因此将不再被发出。perf dump
和perf schema
分别启用或禁用模块。
由 Ceph 基金会带给您
Ceph 文档是一个社区资源,由非盈利的 Ceph 基金会资助和托管Ceph Foundation. 如果您想支持这一点和我们的其他工作,请考虑加入现在加入.