3 Replies Latest reply on May 8, 2014 7:04 PM by TommyReynolds-Oracle

    Benchmarking MySQL on LXC vs KVM


      I'm doing some passive benchmarking with Linux Containers (LXC) vs KVM (1.0, disk cache=none, virtio). Tests are performed within the guest (VM / Container).

      - The instances (VM / Container) are of the same size (e.g. 4G RAM, 2 CPU).

      - Using out of the box MySQL 5.5 server; no custom cnf tweaks, etc..

      - Running sysbench OLTP complex read / write tests.


      What I'm seeing is that in LXC the following perf is substantially better than in KVM:
      - File I/O reads and writes

      - OLTP reads


      However in the sysbench OLTP complex read / write test KVM and LXC are almost the same in terms of transaction throughput (over all thread sizes: 2, 16, 32, 64).


      Do anyone have any incite as to way the OLTP complex r/w tests might be equal (KVM == LXC)?


      Based on the little digging I have done, it appears that the buffer / caching at the db level (e.g. innodb buffer cache and related) may be "throttling" this test and hence LXC perf = KVM perf. Also the complex r/w OLTP test is transactional thus locks the (single) table which could be a limiting factor. However I'd tried non-locking r/w tests as well as the iibench test -- in these cases again KVM == LXC perf wise.


      When I look at the metrics collected from these tests (using dstat) I see the KVM set of tests getting a higher IOPS rate, but I've been unable to determine why.


      Many thanks for any incite.

        • 1. Re: Benchmarking MySQL on LXC vs KVM

          I'm not an expert for KVM or LXC, but doesn't Linux Containers provide Control Groups (cgroups) to limit resource allocation that can also block I/O operations?

          • 2. Re: Benchmarking MySQL on LXC vs KVM

            Btw, doesn't KVM and LXC support hardware assisted virtualization? Could that explain why your results are the same or very similar?

            • 3. Re: Benchmarking MySQL on LXC vs KVM
              1. LXC is a much lighter weight implementation than is KVM: no hypervisor, no I/O emulation and such; it runs on the SAME kernel using the SAME block I/O buffers using the SAME device drivers as does the native Linux kernel; KVM has its own.
              2. There shouldn't be much difference in the LXC vs KVM I/O benchmarks because either one can progbably max out the storage bandwidth.  If you can fill up the bandwidth, how much overflow data you have doesn't matter, you are still limited by the storage bandwidth.  You've probably got bits lying all over the floor :)