XEN 4.0.1 vs KVM 0.12.4 – MySQL and Apache Benchmarks
This articles compares performance of XEN and KVM running MySQL and Apache (separately). I recently read an article about the same issue (but far more in depth) which used Xen 3.x and KVM 0.9.x. I will compare Xen 4.0.1 and KVM 0.12.4 which are more recent
Prelude^
This time, i will not use my desktop pc, but my new server which happens to be in the office. Here are the hardware specs:
- CPU: 2x E5605 Westmere
- RAM: 24GB
- Raid: HW (Adaptec Z 5xxx), write cache enabled
- Storage: Raid1 2xSAS 10k (root) | Raid10, 10x SAS 10k (databases)
Software:
- Debian 6.0 Squeeze
- Linux 2.6.32
- XEN 4.0.1 | KVM 0.12.4
- MySQL 5.1.48
- Apache 2.2.16
- sysbench 0.4.12
Virtual machine specs:
- 2GB RAM
- 2 VCPUs
- 10GB HDD root
- 10GB HDD database
Each virtual container will get 2GB RAM and 2 virtual CPUs.
Tests^
MySQL^
The sysbench commandline looks kind of following:
#> time sysbench --num-threads=2 --max-requests=100000 --test=oltp --oltp-table-size=1000000 --mysql-host=HOST --mysql-db=DB --mysql-user=USER --mysql-password=PASS run
The tests ran with varying amount of threads. The resulting values are an average over three test-runs. The “Operations” are summarized I transactions, read/write requests and other operations (see sysbench results).
The sysbench results can be downloaded here for XEN and here for KVM.
| Execution time | Operations per second | |||
| XEN | KVM | XEN | KVM | |
| 1 Thread | 276s | 325s | 7950 | 6775 |
| 2 Threads | 379s | 338s | 5803 | 6523 |
| 4 Threads | 300s | 352s | 7448 | 6258 |
| 8 Threads | 297s | 327s | 7404 | 6742 |
| 16 Threads | 272s | 324s | 8088 | 6811 |
Besides the break with 2 threads, XEN seems to be 10% to 15% faster then KVM.
Apache static^
In those tests, i used ab to call the default static “it works” page from apache 1000 times with varied concurrency.
XEN benchmarks, KVM benchmarks
| Execution time | Requests per second | |||
| XEN | KVM | XEN | KVM | |
| 1 Concurrent | 225ms | 270ms | 4428 | 3705 |
| 10 Concurrent | 152ms | 161ms | 6611 | 6285 |
| 25 Concurrent | 151ms | 152ms | 6653 | 6579 |
| 50 Concurrent | 151ms | 147ms | 6631 | 6800 |
| 100 Concurrent | 159ms | 140ms | 6307 | 7159 |
Those results are interesting. XEN does start very strong, but KVM seems to handle concurrent requests very well. In the end, XEN’s performance decreases with 100 concurrent requests, where KVM still is able to improve performance. I think KVM is the winner here.
Apache + MySQL: WordPress^
So, XEN seems to outperform in KVM in the MySQL benchmark, whereas KVM wins clearly in the Apache tests. This scenario should be a more “real world”. For testing, i’ve installed a fresh WordPress 3.0 with just enough setup to deliver the “Hello World” page. Again, i’ve used ab to execute the tests.
XEN benchmarks, KVM benchmarks
| Execution time | Requests per second | |||
| XEN | KVM | XEN | KVM | |
| 1 Concurrent | 122s | 130s | 8.2 | 7.7 |
| 10 Concurrent | 62s | 68s | 15.9 | 14.8 |
| 25 Concurrent | 63s | 69s | 15.8 | 14.6 |
| 50 Concurrent | 63s | 69s | 15.8 | 14.5 |
| 100 Concurrent | 76s | 84s | 13.3 | 12.0 |
As it seems, the stronger limiting factor seems to be the mysql performance.
Results^
I will probably stick to XEN for some more time. It proved itself of being stable and with the new 4.x also very fast.
My Name is Ulrich Kautz and this is my private blog about server administration, perl programming and some other stuff that is on my mind. I study part-time computer sience at FU Berlin and work as sys admin and web developer at our hosting company