Add per-container io.max throttling support (cgroups v2) - #509
Merged
winkingturtle-vmw merged 5 commits intoJul 30, 2026
Merged
Conversation
- Add IOMaxReadBps/WriteBps/ReadIOPS/WriteIOPS to Limits struct
- Apply throttle on all real block devices when cgroups v2 is active
- getAllBlockDevices() reads /sys/block, filters loop/ram/dm
- New CLI flags: container-io-max-{read,write}-{bps,iops}
- Zero values = disabled (backward compatible)
Companion PR in garden-runc-release: https://github.com/vpetrinski/garden-runc-release/tree/feature/io-max-throttling
Generated with AI assistance.
Signed-off-by: Viktor Petrinski <v.petrinski@sap.com>
winkingturtle-vmw
approved these changes
Jul 30, 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.
Generated with AI assistance.
Companion PR in garden-runc-release: https://github.com/vpetrinski/garden-runc-release/tree/feature/io-max-throttling
Read the Contributing document.
Summary
Adds per-container disk I/O rate limiting via cgroups v2
io.max. When configured, each new container receives IOPS and throughput limits on all real block devices at creation time.Motivation: A single container can saturate the shared data disk on a Diego cell, starving all other containers of I/O and causing health check timeouts / false app crashes.
Changes:
rundmc/bundlerules/limits.go: ExtendedLimitsstruct withIOMaxReadBps,IOMaxWriteBps,IOMaxReadIOPS,IOMaxWriteIOPS. When any value > 0 and cgroups v2 is active, applies throttle devices to the OCIbundle for all real block devices.
guardiancmd/command.go: Added 4 new CLI flags (--container-io-max-{read,write}-{bps,iops})getAllBlockDevices(): Reads/sys/block, filters virtual devices (loop, ram, dm), returns major:minor for real devices.Tested: Custom dev release deployed on Noble cell (Ubuntu 24.04, cgroups v2). Throttled: 60 MB/s vs Unthrottled: 272 MB/s (4.5× protection). App starts and runs normally with limits active.
Companion PR in garden-runc-release: cloudfoundry/garden-runc-release@develop...vpetrinski:garden-runc-release:feature/io-max-throttling
Generated with AI assistance.
Backward Compatibility
Breaking Change? No
IsCgroup2UnifiedMode()check