I have MySQL (5.7) running in a Docker (18.03.1-ce) container and I'm benchmarking it using Sysbench (1.0.15). When I run Docker with --cpus=1 to limit the cpu utilization of the container, I get poor performance in terms of Transactions Per Second (TPS) and Latency (P99).
docker run --cpus=1 -it --rm mysqldemo
Result: TPS=490 and Latency(P99)=41ms
Now, if I increase the number of cpus to 2 the results get MUCH better.
docker run --cpus=2 -it --rm mysqldemo
Result: TPS=865 and Latency(P99)=1.5ms
Note, this performance boost is NOT simply a result of having more cores because in Sysbench I set the threads to 1. In both runs everything is the same except for the cpus limit.
So, I'm wondering if Docker has some sort of overhead that causes --cpus=1 performance to be poor.