While reading through WHT, I came across a neat little tidbit.
It’s a bit of PHP code that can be used to get an idea as to how fast the processor is on the machine your websites are hosted on – or at least the speed you have available to you. A thanks to “webpan” of the WHT forums for putting up the code he used for his LiquidWeb test.
Basically, you create a php file that looks like this:
<?php
$startTime = microtime(true);
for ($i=0;$i<500;$i++) {
$j++;
for ($k=0;$k<10000;$k++) {
$j++;}
}
$endTime = microtime(true);
$delta = $endTime – $startTime;echo “total time: $delta seconds.n”;
//phpinfo();
?>
Call it “test.php” or something, and put it somewhere on your webserver – then browse and run it. You could modify it to do some more stressful math, but don’t go crazy.
I tried it on 3 hosts, and here were my results:
Each test was run at 3 different time periods during the day. To make things a little more readable the times for each run are only shown to 2 decimal points. The variance here is the sum of the deviations from the average of all 3 tests.
You’ll notice the following:
- WiredTree came out on top, and VPSLink wasn’t far behind. HostGator was the slowest.
- Each run was *very* similar. There was almost no variance, indicating that none of the host machines seem to suffer from high CPU loads at certain points of the day.
But what does it all mean, Basil? (obligatory Austin Powers quote)
Well, as far as processor-intensive PHP tasks go, the WiredTree and VPSLink VPS’s are likely to be quicker, and pump out the results faster. In all likelihood they’re simply using faster processors than HostGator. There could very well be other reasons that HostGator came behind, but the fact of the matter is that there’s more processor speed/power available to both VPS scripts.
Does this mean that HostGator’s slow/bad?
Not at all.
There are so many factors that come into play, that you can’t base a host decision on one type of test. HostGator’s got a lot of servers, and I can guarantee you they’re not all the same. The same probably holds true of the VPS providers. If someone gets a brand-spanking-new machine, it’ll be faster than the old machines. It’s a “luck of the draw” thing as far as which machine you’re put on.
You also have to consider that there are many other things that come into play when you’re looking at how long it takes for a page to load somewhere. There are many things that go into tuning a server. A server that’s strapped for RAM, a poorly tuned MySQL database, a server that’s always waiting on IO, a server connected to the network with a 10Mbps port that’s being maxed out, the server location, and the datacenter’s connectivity are just a few examples of things that can really affect how long it takes for a page to load on the viewer’s end.
The test subjects (aka “You Rigged the Test!”)
I’ll be the first to admit that these weren’t necessarily level playing fields. Here were the candidates:
HostGator
Shared hosting plan
Apache/FCGI/SuExec
VPSLink
Link-4 VPS – Xen
Apache/SuPHP/SuExec
WiredTree
1024 VPS – Virtuozzo
LiteSpeed/LSAPI/SuExec
The way it typically works for PHP speed is this:
DSO > FastCGI >SuPHP
Litespeed’s PHP server’s a little tough to put in there although most of the info out there seems to indicate it may be faster than all the above. I have no way of knowing whether the speed of the above test is affected much by the engine serving up the PHP, although I’d expect the effect to be marginal in a test like this.
SSD 3000
$70/month
and gets this result
total time: 0.924275875092 seconds.n
total time: 0.951939821243 seconds.n
total time: 0.916054964066 seconds.n