Bug #76070
closedBlueStore free fragmentation check causing latency spikes
0%
Description
My Ceph cluster was seeing anomalous write latency spikes once an hour with this being logged by the OSD "bluestore.MempoolThread fragmentation_score=0.277006 took=1.207344s"
I tracked it down to the bluestore_fragmentation_check_period which runs every hour by default and grabs locks which cause write operations to stall. The documentation says this should be almost immediate (https://github.com/ceph/ceph/blob/6cd56aece4bba8651021ce6a0f4f21b3e8b3d43e/src/common/options/global.yaml.in#L5643-L5654), but our setup was seeing this take over 1 second. I've mitigated by only running the check outside of peak hours, but wanted to post here in case other use cases see a similar slow fragmentation check.
System details:- Ceph version 19.2.3
- bluestore_allocator=hybrid
- ~0.27 fragmentation score takes about 1.21s, ~0.19 fragmentation score takes about 0.87s
- Primarily RBD pools with both EC and replicated use cases.
- ~20TB SATA OSD
- Example fragmentation histogram block:
ceph daemon osd.X bluestore allocator fragmentation histogram block
[
{"max_len": 4096, "total": 18313285, "aligned": 18313285, "units": 18313285},
{"max_len": 16384, "total": 22951956, "aligned": 22951956, "units": 61228082},
{"max_len": 65536, "total": 14613416, "aligned": 14613416, "units": 123883064},
...
]
IF Updated by Igor Fedotov 8 months ago
Hey Thomas,
thanks for the report, we'll take care of that.
Meanwhile one can work around the issue by setting 'bluestore_fragmentation_check_period' to zero which will disable fragmentation polling.
Thanks,
Igor
IF Updated by Igor Fedotov 8 months ago
- Status changed from New to Triaged
AK Updated by Adam Kupczyk 8 months ago
- Assignee set to Adam Kupczyk
SS Updated by sunnat samad 3 months ago
Opened a PR to fix this issue:
https://github.com/ceph/ceph/pull/71649
IF Updated by Igor Fedotov 3 months ago
- Status changed from Triaged to Fix Under Review
- Pull request ID set to 71649
PD Updated by Prashant D 3 months ago
- Backport set to tentacle, umbrella
UB Updated by Upkeep Bot 2 months ago
- Copied to Backport #80749: tentacle: BlueStore free fragmentation check causing latency spikes added
UB Updated by Upkeep Bot 2 months ago
- Copied to Backport #80750: umbrella: BlueStore free fragmentation check causing latency spikes added
UB Updated by Upkeep Bot 2 months ago
- Status changed from Fix Under Review to Backporting
- Merge Commit set to ea0c61b257fe27ceacd69630258950c747dcd2b8
- Fixed In set to v21.3.0-3525-gea0c61b257
- Upkeep Timestamp set to 2026-09-22T15:04:45+00:00
SG Updated by Steven Goodliff about 1 month ago
Thanks for posting
we are seeing the same thing on v20.2.3 with it sometimes taking ~2 seconds on a OSD which is classed as having tiny fragmentation. disabled for the time being.