Category: php

  • PHP 4 vs PHP 5 Basic Benchmark

    I’ve been doing some preliminary research and testing to see if upgrading to php 5 is something we want to do on WordPress.com and if so, how soon. Here are the results of a simple apache bench test of a phpinfo page. The test environment was as follows:

    Hardware:

    • Dual AMD Opteron 246
    • 2GB RAM
    • 2 x 160GB SATA drives in a RAID 1 array

    Software:

    • Debian Sarge AMD64
    • Litespeed 3.0.3

    The tests were run from the same machine running the web server so network latency is not a factor. The test parameters were 5000 total requests with a concurrency of 100.

    PHP 4.4.6 with APC 3.0.14
    Concurrency Level: 100
    Time taken for tests: 5.581265 seconds
    Complete requests: 5000
    Failed requests: 0
    Write errors: 0
    Total transferred: 134854586 bytes
    HTML transferred: 134070000 bytes
    Requests per second: 895.85 [#/sec] (mean)
    Time per request: 111.625 [ms] (mean)
    Time per request: 1.116 [ms] (mean, across all concurrent requests)
    Transfer rate: 23595.55 [Kbytes/sec] received

    PHP 5.2.2 with APC 3.0.14
    Concurrency Level: 100
    Time taken for tests: 8.388090 seconds
    Complete requests: 5000
    Failed requests: 0
    Write errors: 0
    Total transferred: 183254839 bytes
    HTML transferred: 182470000 bytes
    Requests per second: 596.08 [#/sec] (mean)
    Time per request: 167.762 [ms] (mean)
    Time per request: 1.678 [ms] (mean, across all concurrent requests)
    Transfer rate: 21334.89 [Kbytes/sec] received

    From these preliminary tests, php 5.2.2 seems about 33% slower than php 4.4.6. Surprising…

    NOTE: One thing that may contribute to the apparent slowness is that the phpinfo page grew from 26814 bytes to 36494 bytes in the upgrade process.

    Has anyone else run similar tests? Are the results the same?