Skip to content

Instantly share code, notes, and snippets.

@moxiegirl
Last active August 29, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save moxiegirl/fb433f62445d80cacf48 to your computer and use it in GitHub Desktop.
Save moxiegirl/fb433f62445d80cacf48 to your computer and use it in GitHub Desktop.

Block IO bandwidth (Blkio) constraint

By default, all containers get the same proportion of block IO bandwidth (blkio). This proportion is 500. To modify this proportion, change the container's blkio weight relative to the weighting of all other running containers using the --blkio-weight flag.

The --blkio-weight flag can set the weighting to a value between 10 to 1000. For example, the commands below create two containers with different blkio weight:

$ sudo docker run -ti --name c1 --blkio-weight 300 ubuntu:14.04 /bin/bash
$ sudo docker run -ti --name c2 --blkio-weight 600 ubuntu:14.04 /bin/bash

If you do block IO in the two containers at the same time, by, for example:

time dd if=/mnt/zerofile of=test.out bs=1M count=1024 oflag=direct

You'll find that the proportion of time is the same as the proportion of blkio weights of the two containers.

Note: The blkio weight setting is only available for direct IO. Buffered IO is not currently supported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment