/ drupal 7

Benchmarking Virtualbox Multiple Core Performance

A while ago, I made a claim that you shouldn't use Virtualbox with a vm that has more than one cpu because it is so slow that it is slower than using just a single core. People rightly called me on it as I didn't provide any sort of evidence that this was the case.

To start off with, there are a few other people that have experienced the same thing. Also, I'm not saying that this is the case for all use cases but, in the context of a Drupal (or any php app for that matter) dev environment, you don't want to use more than one cpu.

The script I'm using to test is what we use to create an empty version of our Drupal sites. You won't have anything thats quite equivalent but, its performance should mirror regular php / mysql app as its using mostly php scripts to load the database with the required values.

ConfigurationTime
4 Cores61m37.419s
2 Cores45m27.327s
1 Cores28m17.904s

I also ran a test where 25 pages were loaded sequentially. Here are the results:

ConfigurationTime
4 Cores1:01.97
2 Cores54.295s
1 Cores37.966s

Now, its important to note that everything that I did is sequential. The build script runs through everything sequeuntialy. Basically, it processes the source files and it then inserts whatever it needs to into mysql. For the page load, it kind of does the same thing in reverse. It loads the required data from mysql and then returns the page. The slight wrinkle in this is that our Drupal stack will cache things in Memcache but, that should be helped by the multiple core vms.

You may want to point out that nothing I did actually does parralel processing, which is true. However, the additional cores should help with both Memcache and MySQL as they would have more processing power available to them. Regardless, that isn't the point. This particular test, I think, is representative of the kind of activities that you would be doing during development of a PHP app (or any other single-threaded application).

Can't all of it be explained by turbo boost? I don't think so. Here is the cpu that I did the testing on. Judging from the turbo frequency chart, I think its likely that the cpu was running between 3.1 and 3.4ghz, given that the load was fairly low. I don't think that is a big enough difference to explain the numbers that I saw.

So, if you use Virtualbox for your dev environment, don't use more than 1 core and disable ioapic. I would recommend that instead you pay for the appropriate version of VMWare and pay for a license of the VMWare provider. Not only is it more stable, it doesn't have this particular problem. For comparison, here are the numbers for VMWare Fusion.

  • Default build: 23m47.832s
  • Page Load: 44.529s