Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for remaining blkio settings #3950

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

swagatbora90
Copy link
Contributor

@swagatbora90 swagatbora90 commented Feb 28, 2025

Nerdctl today has support for --blkio-weight.

This PR adds support for the remaining blkio options (as supported by docker).

--blkio-weight-device    stringArray     Block IO weight (relative device weight) (default [])
--device-read-bps        stringArray     Limit read rate (bytes per second) from a device (default [])
--device-read-iops       stringArray     Limit read rate (IO per second) from a device (default [])
--device-write-bps       stringArray     Limit write rate (bytes per second) to a device (default [])
--device-write-iops      stringArray     Limit write rate (IO per second) to a device (default [])

Requires cgroup v2 and block device scheduler set to bfq

Testing

nerdctl run --rm --blkio-weight=1000 ubuntu dd bs=1M count=10024 if=/dev/zero of=/dump.dat oflag=direct status=progress
nerdctl run --rm --blkio-weight-device="/dev/xvda:1000" ubuntu dd bs=1M count=10024 if=/dev/zero of=/dump.dat oflag=direct status=progress
[root@ip-172-31-8-69 bin]# /home/ec2-user/nerdctl run --rm --device-write-bps="/dev/xvda:10mb" ubuntu dd bs=1M count=10024 if=/dev/zero of=/dump.dat oflag=direct status=progress
52428800 bytes (52 MB, 50 MiB) copied, 5 s, 10.5 MB/s

@swagatbora90 swagatbora90 force-pushed the blkio-options branch 4 times, most recently from 45a457d to ef71f08 Compare February 28, 2025 16:18
@swagatbora90 swagatbora90 marked this pull request as ready for review February 28, 2025 16:51
@swagatbora90
Copy link
Contributor Author

swagatbora90 commented Feb 28, 2025

Test failures do not appear to be related to the specific change. Previous runs have already passed those checks.


func TestRunBlkioSettingCgroupV2(t *testing.T) {
t.Parallel()
testutil.DockerIncompatible(t)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this docker imcompatible?

switch info.CgroupDriver {
case "none", "":
t.Skip("test requires cgroup driver")
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duplicated with line 429-431

}

for _, tt := range tests {
tt := tt // capture range variable
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is no longer needed after go 1.22 (or 1.21? not sure the exact version)

@@ -414,7 +414,7 @@ IPFS flags:
- :nerd_face: `--ipfs-address`: Multiaddr of IPFS API (default uses `$IPFS_PATH` env variable if defined or local directory `~/.ipfs`)

Unimplemented `docker run` flags:
`--blkio-weight-device`, `--cpu-rt-*`, `--device-*`,
`--cpu-rt-*`, `--device-cgroup-rule`,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you also add these new flags to the this command doc?

Comment on lines +153 to +163
BlkioWeight uint16
// BlkioWeightDevice specifies the Block IO weight (relative device weight)
BlkioWeightDevice []string
// BlkioDeviceReadBps specifies the Block IO read rate limit(bytes per second) of a device
BlkioDeviceReadBps []string
// BlkioDeviceWriteBps specifies the Block IO write rate limit(bytes per second) of a device
BlkioDeviceWriteBps []string
// BlkioDeviceReadIOps specifies the Block IO read rate limit(IO per second) of a device
BlkioDeviceReadIOps []string
// BlkioDeviceWriteIOps specifies the Block IO read rate limit(IO per second) of a device
BlkioDeviceWriteIOps []string
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to support these flags in other commands? If so I suggest we create a separate struct, e.g., Blkio.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants