OK, I looked at the documentation for docs.rs, and it looks like each crate is built within its own docker image. So this actually gives us a really simple procedure for dealing with the issue that allows us to reweight the relative performance of each build on the fly:
- On start up, use
docker update -c
to set the CPU share to 8. (see this article for an explanation of the CPU share option). - For every 15 minutes of runtime of a given container, decrease the container's CPU share by 1, to a minimum of 1.
- There is no step 3.
Basically, this is kind of like using renice
, but on the container as a whole, which means that resources are idle only if there's no work to do.