I am testing on a completely empty ( no users other than the testing ) server with 8 AMD cores and indel 3500 SSD drives. The KVM uses virtio in both HD and network and default cpu ( actually tried the native cpu too same results ) and tried multiple caching options but the differences where small.
I used the tests in this page http://www.howtoforge.com/how-to-benchmark-your-system-cpu-file-io-mysql-with-sysbench
The Mysql benchmark is as below
sysbench --test=oltp --oltp-table-size=1000000 --mysql-db=test --mysql-user=root --mysql-password=yourrootsqlpassword prepare
then
sysbench --test=oltp --oltp-table-size=1000000 --mysql-db=test --mysql-user=root --mysql-password=yourrootsqlpassword --max-time=60 --oltp-read-only=on --max-requests=0 --num-threads=8 run
On the main server I get
transactions: 81373 (1356.13 per sec.)
Running on openvz with all cpus available to the vm
transactions: 86230 (1437.10 per sec.)
(openvz was higher might just be run variation that vz is higher but it shows that vz is veryclose to baremetal enough that indicidual variation makes a difference )
But when running on KVM with all the cpus available to the VM
transactions: 44220 (736.93 per sec.)
This is a HUGE drop close to unacceptable
When doing the pure cpu benchmark
sysbench --test=cpu --cpu-max-prime=20000 run
baremetal gets
execution time (avg/stddev): 18.7910/0.00
( in seconds so lower is better )
And in the kvm machine
execution time (avg/stddev): 20.4926/0.00
Which is an acceptable slow down and point that the problem is IO.
I used the tests in this page http://www.howtoforge.com/how-to-benchmark-your-system-cpu-file-io-mysql-with-sysbench
The Mysql benchmark is as below
sysbench --test=oltp --oltp-table-size=1000000 --mysql-db=test --mysql-user=root --mysql-password=yourrootsqlpassword prepare
then
sysbench --test=oltp --oltp-table-size=1000000 --mysql-db=test --mysql-user=root --mysql-password=yourrootsqlpassword --max-time=60 --oltp-read-only=on --max-requests=0 --num-threads=8 run
On the main server I get
transactions: 81373 (1356.13 per sec.)
Running on openvz with all cpus available to the vm
transactions: 86230 (1437.10 per sec.)
(openvz was higher might just be run variation that vz is higher but it shows that vz is veryclose to baremetal enough that indicidual variation makes a difference )
But when running on KVM with all the cpus available to the VM
transactions: 44220 (736.93 per sec.)
This is a HUGE drop close to unacceptable
When doing the pure cpu benchmark
sysbench --test=cpu --cpu-max-prime=20000 run
baremetal gets
execution time (avg/stddev): 18.7910/0.00
( in seconds so lower is better )
And in the kvm machine
execution time (avg/stddev): 20.4926/0.00
Which is an acceptable slow down and point that the problem is IO.