You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
perf(chunkserver): Protect IO performance during massive delete
This PR further reduces trash-GC impact on foreground I/O
by dynamically throttling expired-file deletion based on observed
disk throughput, and improves delete wall-clock time
by running removals per-disk in parallel.
Key changes:
- I/O-aware GC throttling (with floor guard)
- Adds GC-specific I/O counters in HddStats
and increments them on every read/write accounting path.
- In ChunkTrashManagerImpl::collectGarbage():
- Samples and resets GC I/O counters each cycle (exchange(0)).
- Normalizes by disk count (gDisks.size() under gDisksMutex)
to estimate per-disk pressure.
- Maintains max observed per-disk bytes (read/write) to create
a stable baseline.
- Computes totalIOPercentage and feeds it through
an inverted sigmoid (steepness=12, center=0.3) to scale down
trashGarbageCollectorBulkSize under load.
- Adds a minimum threshold: only perform expired-file deletion
when the scaled bulk size is >= 5, preventing “death by a thousand
tiny deletes” during heavy I/O.
- Parallel trash removal across disks
-removeTrashFiles() now spawns a std::jthread per disk and
delegates actual deletion/index updates to removeTrashFilesFromDisk()
allowing independent disks to progress concurrently.
- Behavioral defaults
- CHUNK_TRASH_ENABLED default flips 0 → 1 (trash manager enabled
unless explicitly disabled).
- Default retention (kDefaultTrashTimeLimitSeconds) flips 259200 → 0
(immediate expiry unless configured).
- Changed documentation accordingly.
- Resource thread pacing
- hddFreeResourcesThread() loop period increases 2s → 3s,
replacing sleep() with Timeout + usleep(timeout.remaining_us())
for more precise loop cadence.
- Changed the functionality of implMutex for protecting only
the getter and setter of the current GC implementation.
- Test dependency:
- Disabled GC for rebalancing test, mainly because chunks
in trash affect disk usage statistics.
-Added more sleep time to sfschunkserver_check_no_buffer_in_use()
given that GC cycles now take more time.
Rationale:
Large delete storms can saturate disks and degrade chunkserver latency.
This patch makes the garbage collector self-throttling using real I/O
signals and avoids thrashing by skipping deletion work when
the system is already busy, while parallelizing deletes per disk
to reclaim space faster when bandwidth is available.
Signed-off-by: GigaCronos <jorge.cabrera@leil.io>
0 commit comments