注意

本文档适用于 Ceph 的开发版本。

Perf Histograms

Perf Histograms 建立在 perf counters 基础设施之上。直方图针对许多计数器构建,并简化了收集数据,以便了解哪些组的计数器值在一段时间内最常出现。Perf Histograms 目前是无符号 64 位整数计数器,因此它们主要用于时间和大小。通过 perf histogram 转储的数据可以馈送到其他分析工具/脚本中。

访问

perf histogram 数据通过 admin socket 访问。例如

ceph daemon osd.0 perf histogram schema
ceph daemon osd.0 perf histogram dump

集合

直方图被分组到命名集合中,通常代表一个子系统或一个子系统的实例。例如,内部 throttle 机制报告有关其如何进行节流的统计信息,每个实例的命名类似于

op_r_latency_out_bytes_histogram
op_rw_latency_in_bytes_histogram
op_rw_latency_out_bytes_histogram
...

模式

perf histogram schema 命令转储一个 json 描述,说明哪些值可用,以及它们的类型。每个命名值都有一个 type 位域,第 5 位始终设置,后续位已定义。

含义

1

浮点值

2

无符号 64 位整数值

4

平均值(总和 + 计数对)

8

计数器(与 gauge 相比)

换句话说,类型为“18”的直方图是无符号 64 位整数值的直方图 (16 + 2)。

这是一个 schema 输出的示例

{
    "AsyncMessenger::Worker-0": {},
    "AsyncMessenger::Worker-1": {},
    "AsyncMessenger::Worker-2": {},
    "mutex-WBThrottle::lock": {},
    "objecter": {},
    "osd": {
        "op_r_latency_out_bytes_histogram": {
            "type": 18,
            "description": "Histogram of operation latency (including queue time) +   da  ta read",
            "nick": ""
        },
        "op_w_latency_in_bytes_histogram": {
            "type": 18,
            "description": "Histogram of operation latency (including queue time) +   da  ta written",
            "nick": ""
        },
        "op_rw_latency_in_bytes_histogram": {
            "type": 18,
            "description": "Histogram of rw operation latency (including queue time)   +   data written",
            "nick": ""
        },
        "op_rw_latency_out_bytes_histogram": {
            "type": 18,
            "description": "Histogram of rw operation latency (including queue time)   +   data read",
            "nick": ""
        }
    }
}

转储

实际转储与模式类似,只是存在实际的值组。例如

"osd": {
    "op_r_latency_out_bytes_histogram": {
        "axes": [
            {
                "name": "Latency (usec)",
                "min": 0,
                "quant_size": 100000,
                "buckets": 32,
                "scale_type": "log2",
                "ranges": [
                    {
                        "max": -1
                    },
                    {
                        "min": 0,
                        "max": 99999
                    },
                    {
                        "min": 100000,
                        "max": 199999
                    },
                    {
                        "min": 200000,
                        "max": 399999
                    },
                    {
                        "min": 400000,
                        "max": 799999
                    },
                    {
                        "min": 800000,
                        "max": 1599999
                    },
                    {
                        "min": 1600000,
                        "max": 3199999
                    },
                    {
                        "min": 3200000,
                        "max": 6399999
                    },
                    {
                        "min": 6400000,
                        "max": 12799999
                    },
                    {
                        "min": 12800000,
                        "max": 25599999
                    },
                    {
                        "min": 25600000,
                        "max": 51199999
                    },
                    {
                        "min": 51200000,
                        "max": 102399999
                    },
                    {
                        "min": 102400000,
                        "max": 204799999
                    },
                    {
                        "min": 204800000,
                        "max": 409599999
                    },
                    {
                        "min": 409600000,
                        "max": 819199999
                    },
                    {
                        "min": 819200000,
                        "max": 1638399999
                    },
                    {
                        "min": 1638400000,
                        "max": 3276799999
                    },
                    {
                        "min": 3276800000,
                        "max": 6553599999
                    },
                    {
                        "min": 6553600000,
                        "max": 13107199999
                    },
                    {
                        "min": 13107200000,
                        "max": 26214399999
                    },
                    {
                        "min": 26214400000,
                        "max": 52428799999
                    },
                    {
                        "min": 52428800000,
                        "max": 104857599999
                    },
                    {
                        "min": 104857600000,
                        "max": 209715199999
                    },
                    {
                        "min": 209715200000,
                        "max": 419430399999
                    },
                    {
                        "min": 419430400000,
                        "max": 838860799999
                    },
                    {
                        "min": 838860800000,
                        "max": 1677721599999
                    },
                    {
                        "min": 1677721600000,
                        "max": 3355443199999
                    },
                    {
                        "min": 3355443200000,
                        "max": 6710886399999
                    },
                    {
                        "min": 6710886400000,
                        "max": 13421772799999
                    },
                    {
                        "min": 13421772800000,
                        "max": 26843545599999
                    },
                    {
                        "min": 26843545600000,
                        "max": 53687091199999
                    },
                    },
                    {
                        "min": 53687091200000
                    }
                ]
            },
            {
                "name": "Request size (bytes)",
                "min": 0,
                "quant_size": 512,
                "buckets": 32,
                "scale_type": "log2",
                "ranges": [
                    {
                        "max": -1
                    },
                    {
                        "min": 0,
                        "max": 511
                    },
                    {
                        "min": 512,
                        "max": 1023
                    },
                    {
                        "min": 1024,
                        "max": 2047
                    },
                    {
                        "min": 2048,
                        "max": 4095
                    },
                    {
                        "min": 4096,
                        "max": 8191
                    },
                    {
                        "min": 8192,
                        "max": 16383
                    },
                    {
                        "min": 16384,
                        "max": 32767
                    },
                    {
                        "min": 32768,
                        "max": 65535
                    },
                    {
                        "min": 65536,
                        "max": 131071
                    },
                    {
                        "min": 131072,
                        "max": 262143
                    },
                    {
                        "min": 262144,
                        "max": 524287
                    },
                    {
                        "min": 524288,
                        "max": 1048575
                    },
                    {
                        "min": 1048576,
                        "max": 2097151
                    },
                    {
                        "min": 2097152,
                        "max": 4194303
                    },
                    {
                        "min": 4194304,
                        "max": 8388607
                    },
                    {
                        "min": 8388608,
                        "max": 16777215
                    },
                    {
                        "min": 16777216,
                        "max": 33554431
                    },
                    {
                        "min": 33554432,
                        "max": 67108863
                    },
                    {
                        "min": 67108864,
                        "max": 134217727
                    },
                    {
                        "min": 134217728,
                        "max": 268435455
                    },
                    {
                        "min": 268435456,
                        "max": 536870911
                    },
                    {
                        "min": 536870912,
                        "max": 1073741823
                    },
                    {
                        "min": 1073741824,
                        "max": 2147483647
                    },
                    {
                        "min": 2147483648,
                        "max": 4294967295
                    },
                    {
                        "min": 4294967296,
                        "max": 8589934591
                    },
                    {
                        "min": 8589934592,
                        "max": 17179869183
                    },
                    {
                        "min": 17179869184,
                        "max": 34359738367
                    },
                    {
                        "min": 34359738368,
                        "max": 68719476735
                    },
                    {
                        "min": 68719476736,
                        "max": 137438953471
                    },
                    {
                        "min": 137438953472,
                        "max": 274877906943
                    },
                    {
                        "min": 274877906944
                    }
                ]
            }
        ],
        "values": [
            [
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0
            ],
            [
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0
            ],
            [
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0
            ],
            [
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0
            ],
            [
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0
            ],
            [
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0
            ],
            [
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0
            ],
            [
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0
            ],
            [
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0
            ]
        ]
    }
},

这代表 2D 直方图,包含 9 个历史条目和每个历史条目 32 个值组。“Ranges”元素表示每个值组的值边界。“Buckets”表示值组的数量(“buckets”),“Min”是最小接受值,“quant_size”是量化单位,“scale_type”是“log2”(对数刻度)或“linear”(线性刻度)。您可以使用 histogram_dump.py 工具(参见 src/tools/histogram_dump.py)快速可视化现有直方图数据。

由 Ceph 基金会为您呈现

Ceph 文档是由非营利性 Ceph 基金会 资助和托管的社区资源。如果您希望支持这项工作和我们的其他努力,请考虑 立即加入