Add cgroups support for Linux targets #96
This functionality seems to be perfect. In a setup with 4 physical cores and Docker container being limited to 1.0 CPU, a benchmark of a simple async actix-web based microservice resulted in 1 worker thread being run instead of 4, causing up to 50% increase in CPU efficiency:
Workloads like this also ask for ceiling, rather than flooring, non-unit CPU soft-limits, as otherwise actix-web would not be able to saturate available resources (I can perform benchmark with e.g. 1.5 CPUs if desired).
This change can easily have high reach and noticeable impact (benchmark above being probably the extreme case), as num_cpus::get seems to be used in major async runtimes (and beyond), and it is probably not uncommon to limit CPU usage in container orchestration systems like Kubernetes. Maybe it would be worth a prominent announcement?
Sure! An SVG version (if handy) is at https://storage.googleapis.com/strohel-num-cpus-containerized/bench-results.cpu_per_request_figure.svg
It should be probably accompanied by some context from my above post in order not to create false expectations (the same efficiency increase could be achieved by manually setting ideal number of workers; I still think this is a huge win as people probably don't do it).