CI: cap the RustFS blocking-thread pool on the CAS-S3 lanes and collect its log - #2384
Merged
Merged
Conversation
…b artifact RustFS shares the job container's cgroup with the ClickHouse server, so its memory is charged against `max_server_memory_usage`. RustFS 1.0.0-rc.3 grows its tokio blocking-thread pool one thread per concurrent blocking dispatch and keeps idle threads for 60 s; each thread pins about 13 MB. On the MSan CAS-S3 stateless shards this reached 1074 threads and 14 GB of anonymous memory over three hours. Set the runtime knobs that cap the pool and let it shrink, enable allocator reclaim, and use relaxed durability (no fsync chain; the pool is wiped per run). Measured locally on the same six-pass workload: 1074 -> 130 threads, 14.4 GB -> 2.5 GB anonymous, `rename_data` 44-69 ms -> 0.6 ms, the run 30% faster. `RUSTFS_OBS_USE_STDOUT=true` routes the RustFS log (error level by default) into `rustfs.log`, which the job already uploads; without it RustFS writes under its cwd and the artifact stays empty. Related: #2298 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GhVd7eMAWdFubNk4g1B2Tx Signed-off-by: Mikhail Filimonov <mfilimonov@altinity.com>
k-morozov
self-requested a review
September 16, 2026 10:58
k-morozov
approved these changes
Sep 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CI only, one file (
ci/jobs/scripts/clickhouse_proc.py,start_rustfs): environment knobs for the RustFS instance that backs the CAS-S3 stateless lanes, plus routing its log into the existingrustfs.logartifact. No server code, no test changes.Why RustFS memory counts as ClickHouse memory. The stateless job runs the server, MinIO, azurite, RustFS and the test workers in one docker container, i.e. one cgroup, with no
--memoryflag. The server'sMemoryWorkeruses the cgroup source, which sums the whole cgroup'sanonfrommemory.stat, andmax_server_memory_usageis derived from the host (0.9 × 30.6 GiB). So every byte RustFS allocates is charged against the server's limit: it inflatesMemoryTracking, drives the memory-cappedmax_threads, and under ASan produced theCode: 241storms.Why RustFS grows. RustFS 1.0.0-rc.3 runs every disk I/O through tokio's
spawn_blocking: under the default strict durability a PUT costs four or more blocking dispatches (write, fsync chain, rename). The blocking pool grows one thread per concurrent dispatch, an idle thread lives 60 s, and each thread pins about 12 MB of retained mimalloc arena plus a 1 MiB stack. Under a parallel test suite the pool only ratchets up: on a three-hour MSan shard it reached 1074 threads and 14 GB of anonymous memory (r = 0.95 between thread count and RSS). The same mechanism also maderename_datacost 37–69 ms per call.Knobs
RUSTFS_RUNTIME_MAX_BLOCKING_THREADS64RUSTFS_RUNTIME_THREAD_KEEP_ALIVE5RUSTFS_ALLOCATOR_RECLAIM_ENABLEDtrueRUSTFS_ALLOCATOR_RECLAIM_INTERVAL_SECS30RUSTFS_DURABILITY_MODErelaxedrename_dataand halves thread demand. Acceptable for CI: the pool lives underci/tmpand is wiped per runRUSTFS_OBS_USE_STDOUTtruerustfs.logartifact gets content; today RustFS writes tologs/under its cwd and the artifact is nearly emptyLocal measurement (same six-pass workload of the MSan CAS-S3 shard, CI MSan binary, two RustFS instances; knobs applied to the CAS instance only, the other one as control):
rename_dataper callCode: 241in test outputThe five memory knobs were measured together, so their individual contributions are not separated; the durability knob is the one with a semantic cost and is intended for CI only. The RustFS log volume at error level was 1.5 MB over 143 minutes.
Related: #2298
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
CI: cap the RustFS blocking-thread pool and enable allocator reclaim on the CAS-S3 stateless lanes, so the object store no longer inflates the server's cgroup memory; collect the RustFS log as an artifact.
Documentation entry for user-facing changes
CI/CD Options
Exclude tests:
Regression jobs to run:
🤖 Generated with Claude Code
https://claude.ai/code/session_01GhVd7eMAWdFubNk4g1B2Tx