PHP performance optimisation is a growing concern with web developers who are obsessed with shaving milliseconds from their php code execution and there is a need to benchmark php performance so that you can compare the performance of your PHP

Recently, we had a client wanting to host their sites on our VM hosting platform but they were currently hosting their sites on a dedicated server hardware at a US based hosting provider and they wanted to benchmark the PHP performance on our VM hosting platform before migration.

The script used to benchmark the PHP performance was taken from http://www.php-benchmark-script.com which is a PHP script and performs some simple mathematics and string manipulating functions repetitively, and records the PHP code execution time it takes to complete the PHP functions.

>> Client’s existing dedicated server @ US web host with SSD Disks
————————————–
|        PHP BENCHMARK SCRIPT        |
————————————–
Start : 2016-04-05 11:54:38
Server :
PHP version : 5.5.31
Platform : Linux
————————————–
test_math                 : 1.093 sec.
test_stringmanipulation   : 1.138 sec.
test_loops                : 0.644 sec.
test_ifelse               : 0.512 sec.
————————————–
Total time:               : 3.387 sec.

>> Client’s existing dedicated server @ US web host with SSD Disks
————————————–
|        PHP BENCHMARK SCRIPT        |
————————————–
Start : 2016-04-05 11:54:38
Server :
PHP version : 5.5.31
Platform : Linux
————————————–
test_math                 : 1.093 sec.
test_stringmanipulation   : 1.138 sec.
test_loops                : 0.644 sec.
test_ifelse               : 0.512 sec.
————————————–
Total time:               : 3.387 sec.

>> Single CPU Dedicated E3 1270 CPU @ 3.50 Ghz with SSD Disks
————————————–
|        PHP BENCHMARK SCRIPT        |
————————————–
Start : 2016-04-06 18:25:46
Server :
PHP version : 5.5.31
Platform : Linux
————————————–
test_math                 : 0.956 sec.
test_stringmanipulation   : 0.933 sec.
test_loops                : 0.577 sec.
test_ifelse               : 0.366 sec.
————————————–
Total time:               : 2.832 sec. (16% faster then the client’s current server)

> Dual CPU Dedicated Server @ 2.10 Ghz BUT with PHP 5.3.3
————————————–
|        PHP BENCHMARK SCRIPT        |
————————————–
Start : 2016-04-06 19:00:24
Server :
PHP version : 5.3.3
Platform : Linux
————————————–
test_math                 : 1.616 sec.
test_stringmanipulation   : 1.680 sec.
test_loops                : 1.407 sec.
test_ifelse               : 1.109 sec.
————————————–
Total time:               : 5.812 sec.
(70% slower in performance then the client’s dedicated server)

From the above results we were able to conclude the following:

  • It seemed that the php benchmark script executed fastest on the single CPU dedicated server which had a higher clock CPU and SSD disks.
  • The same script on a dual CPU server BUT with lower CPU power and a much older php version (5.3.3) performed quite poorly.

However, the same php performance script on our new VM platform was giving a good output and comparable to the dedicated server at the clients server. I am guessing this is due to the fact that this server has a higher clocking CPU and with DDR4 server RAM.

>> VPS server for with PHP 5.5.33 @ 2.40 Ghz CPU
————————————–
|        PHP BENCHMARK SCRIPT        |
————————————–
Start : 2016-04-06 19:01:43
Server :
PHP version : 5.5.33
Platform : Linux
————————————–
test_math                 : 1.191 sec.
test_stringmanipulation   : 1.214 sec.
test_loops                : 0.763 sec.
test_ifelse               : 0.478 sec.
————————————–
Total time:               : 3.646 sec.
(Only 7.5% slower in performance then the client’s dedicated server)

>> Same VPS enabled with PHP 5.6.19 @ 2.40 Ghz CPU
————————————–
|        PHP BENCHMARK SCRIPT        |
————————————–
Start : 2016-04-06 19:00:02
Server :
PHP version : 5.6.19
Platform : Linux
————————————–
test_math                 : 1.183 sec.
test_stringmanipulation   : 1.217 sec.
test_loops                : 0.766 sec.
test_ifelse               : 0.451 sec.
————————————–
Total time:               : 3.617 sec.
(Only 6.7% slower in performance then the client’s dedicated server!)

From the above php performance testing results it seems that our new VM platform configured with the latest Intel E5 V3 CPUs and DDR4 RAMs perform as good as the bare metal dedicated servers but at a considerable lesser of the cost of dedicated servers. I am sure with additional tweaks to the PHP engine, the performance might be as good or even better then their dedicated server and it is recommended to upgrade to the latest stable version of PHP, irrespective of whether the server is dedicated or VM based as that would give it a performance boost.

Coupled with the other advantages of easy manageability, greater flexibility of resource management on demand and low latency for hosting servers within India, the time is right for clients to move their offshore servers to India and get the best of breed hosting solutions from numerous capable web hosting providers in India.