github.com/intel/goresctrl@v0.5.0/doc/blockio.md (about) 1 # Block I/O 2 3 ## Background 4 5 The cgroup block I/O controller, 6 [blkio](https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v1/blkio-controller.html) 7 in cgroup v1, 8 [io](https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html#io) 9 in cgroup v2, in Linux kernel controls I/O scheduler weights and I/O 10 bandwidth per block device. 11 12 The blockio package in goresctrl is configured with class-based block 13 I/O controller parameters, where different parameters can be 14 configured for each class. The package provides two separate output 15 options: parameters of a class can be applied directly to cgroup v1 16 directory structure, or they can be exported as 17 [Linux BlockIO OCI spec](https://github.com/opencontainers/runtime-spec/blob/master/config-linux.md#block-io). 18 19 ## API 20 21 The API is described in 22 [pkg.go.dev](https://pkg.go.dev/github.com/intel/goresctrl/pkg/blockio). 23 24 ## Configuration 25 26 Block I/O classes can be configured with a yaml file. Example: 27 28 ``` 29 Classes: 30 31 # Define a blockio class "LowPrioThrottled". 32 # Containers in this class will be throttled and handled as 33 # low priority in the I/O scheduler. 34 35 LowPrioThrottled: 36 37 # Weight without a Devices list specifies the default 38 # I/O scheduler weight for all devices 39 # that are not explicitly mentioned in following items. 40 # This will be written to cgroups(.bfq).weight. 41 # Weights range from 10 to 1000, the default is 100. 42 43 - Weight: 80 44 45 # Set all parameters for all /dev/sd* and /dev/vd* block 46 # devices. 47 48 - Devices: 49 - /dev/sd[a-z] 50 - /dev/vd[a-z] 51 ThrottleReadBps: 50M # max read bytes per second 52 ThrottleWriteBps: 10M # max write bytes per second 53 ThrottleReadIOPS: 10k # max read io operations per second 54 ThrottleWriteIOPS: 5k # max write io operations per second 55 Weight: 50 # I/O scheduler (cfq/bfq) weight for 56 # these devices will be written to 57 # cgroups(.bfq).weight_device 58 59 # Set parameters particularly for SSD devices. 60 # This configuration overrides above configurations for those 61 # /dev/sd* and /dev/vd* devices whose disk id contains "SSD". 62 63 - Devices: 64 - /dev/disk/by-id/*SSD* 65 ThrottleReadBps: 100M 66 ThrottleWriteBps: 40M 67 # Not mentioning Throttle*IOPS means no I/O operations 68 # throttling on matching devices. 69 Weight: 50 70 71 # Define a blockio class "HighPrioFullSpeed". 72 # There is no throttling on these containers, and 73 # they will be prioritized by the I/O scheduler. 74 75 HighPrioFullSpeed: 76 - Weight: 400 77 ```