Ceph 存储空间使用率统计数据解读

Luminous Ceph 的存储空间使用统计

Luminous 时每个pool 的USED 是用户数据大小(未经过压缩前的,per-pool 的RAW USED也是未经压缩的考虑了副本数的数据大小),而GLOBAL 的RAW USED 是实际分配的硬盘空间大小(压缩后的)。
Sage: "The per-pool USED is the logical user data written (before compression). The RAW USED space is the actual on-disk space consumed (after compression). That's why they vary."
https://tracker.ceph.com/issues/20870

  • Luminous Ceph:

(3206+311)3=10551M < 22032M (GLOBAL RAW USED)
一般的,每个三副本pool USED
3 = RAW USED
USED = sum.num_bytes
RGW USED = sum.num_bytes * raw_used_rate * curr_object_copies_rate,curr_object_copies_rate 是未降级副本率(<=1),raw_used_rate 相当于副本数。
一句话,luminous 的pool USED 结果是不合适的,USED 不应当作为用户对象数据的逻辑大小总和。USED 应当是从硬盘实际占有考虑,N 版后per-pool 用户数据大小使用STORED 表示,USED 是实际空间分配的大小。
N版之后是通过store_stats 计算的,N版之前的pool USED 都是通过stats 计算的,
store_stats 的统计是BlueStore 做的,和OSD 的USED 统计是一致的。一致以来GLOBAL USED 的计算是跟OSD 一致的,都是通过ObjectStore 层获取的。因此GLOBAL USED 和OSDs USED 是可以对上的,但是和L 版的pool USED 是对不上的(通过stats 计算获取)。

object_stat_sum_t 是对象统计的汇总。

N 版后的改进

pr https://github.com/ceph/ceph/pull/19454 后,ceph df 给出的集群和存储池空间统计出现重大变化,但是未backport 至L 版和M 版:

  1. 【GLOBAL section】: USED 是所有block 设备上保存的对象数据之和(所有OSDs 之和),RAW USED 是包含USED 和在block 上的Ceph 软件系统自身的数据占用(如BlueFS )。
  2. 【POOLS section】:RAW USED 被删除了;USED 包含当前pool 在所有OSDs上空间分配使用大小,包含了副本、分配粒度、纠删码擦除、数据压缩和小对象数据空洞,但不包含在block 上的Ceph 软件系统自身的数据占用(如BlueFS )。STORED 是Ceph用户视角在pool 上存的数据大小,类似之前的USED,但是计算更精确了(包含了文件空洞,OMAP 占用 )。
uint64_t get_used() const
{ return total - available - internally_reserved; }

// this accumulates both actually used and statfs's internally_reserved
uint64_t get_used_raw() const
{ return total - available; }

由上面的计算公式可知:used 肯定是不大于raw 的

BlueStore 的压缩:https://docs.ceph.com/en/latest/rados/configuration/bluestore-config-ref/#inline-compression

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章