These days everybody is moving stuff to the cloud. In many cases there are good reasons to do so. Administering hardware is not what running a modern company is all about in most cases. The key advantage is that virtualization allows people to add and remove servers as needed. However, what does this all mean to performance?

Some time ago I posted a report on my observations with XEN. As my XEN tests are already a bit outdated I decided to run a small test on VirtualBox to see, what happens to performance.

Hardware setup

To get a rough feeling I used my local desktop box, which is a 4 core Intel i5-4460 (3.2 Ghz). I don’t expect too much of a difference on better hardware. VirtualBox was given all CPU cores and 16 GB of memory. However, the amount of data used in the test never exceeds the amount of RAM available so it is not an issue.

Compiling PostgreSQL

The first thing I did was to compile PostgreSQL to see, what happens to single CPU performance. Here are the results:

real hardwareVirtualBox
configure7.9 sec15.5 sec
make install2 min 31.8 sec3 min 0.1 sec

To me this actually looks pretty good. The loss is somewhat acceptable and actually a bit smaller than expected.

Running pgbench

To do a brief test, I created a benchmarking database: pgbench -i -s 10

The output is a small database containing 1 million rows.

The interesting part is that a readonly test shows fairly large differences between “real” iron and my VirtualBox. On real hardware I got around 77.600 TPS, while VirtualBox failed to exceed 19100 TPS. Interestingly the tests show that the loss in performance is pretty consistent with what we got a couple of years ago on XEN.