by Kevin Schroeder | 10:33 am

<update>Magento 1 now supports PHP 5.4</update>

I woke up this morning with a burning desire to do load tests.  Actually, I woke up with a burning desire to not do the same thing I did yesterday and needed a slight change, so I decided to do a load test.  I wanted to see what the performance difference for Magento was between PHP versions 5.3, 5.4 and 5.5RC3.

As you may know, Magento only supports 5.3 and 5.2.  Personally, I would not even be thinking about running any kind of remotely serious ECommerce site on PHP 5.2.  But with work on PHP 5.5 pushing towards GA it means that some time soon support for 5.3 willing be going away.  This might be a bit of a problem for software that isn’t supported on 5.4+.  One of the reasons for this is that there are bugs in PHP that are holding back support.  I don’t know what they all are but this one regarding XML processing is one.  There might be others, but that’s one that I know of.

But enough about bugs, what about performance.  For PHP 5.3 and 5.4 I used Zend Server with Optimizer+.  This is partially because I use Zend Server on my local machine and also because it would give a good comparison with PHP 5.5 since Optimizer+ has been open sourced and will be included.

The configure settings I used for PHP 5.5 is this

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
./configure  
  --with-config-file-path=/etc/php-5.5
  --with-config-file-scan-dir=/etc/php-5.5/php.d 
  --disable-debug 
  --enable-inline-optimization 
  --disable-all 
  --enable-libxml 
  --enable-session 
  --enable-xml 
  --enable-hash 
  --with-pear 
  --with-layout=GNU 
  --enable-filter 
  --with-pcre-regex 
  --with-zlib 
  --enable-simplexml 
  --enable-dom 
  --with-openssl 
  --enable-pdo 
  --with-pdo-sqlite 
  --with-readline 
  --with-iconv 
  --with-sqlite3 
  --disable-phar 
  --enable-xmlwriter 
  --enable-xmlreader 
  --enable-mysqlnd 
  --enable-json 
  --with-gd 
  --enable-soap 
  --with-curl 
  --with-apxs2 
  --enable-ctype 
  --with-pdo-mysql 
  --prefix=/opt/php-5.5 
  --enable-opcache

My 5.5 opcode cache settings were this

1
2
3
4
5
6
7
zend_extension=opcache.so
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
opcache.revalidate_freq=60
opcache.fast_shutdown=1
opcache.enable_cli=1

I make no guarantees that these are the optimal settings.

I used Siege as the load test running against a single URL that had some relatively complex logic in it.  I was using Magento Enterprise 1.13, but had full page caching turned off.  I ran with only 4 concurrent sessions since that’s how many CPU’s are on the machine I was testing.  This was not a test of server capacity, but of raw performance.  I suppose that a single concurrent session would have been better, but se la vis.  I didn’t see a drop in response time until I went to 5 concurrent sessions anyway so I doubt this was an issue.

The first chart is the throughput per second, so higher is better.

magento-php-line

As you can see, PHP 5.4 and 5.5 faired better than 5.3.  5.5 faired just a little better than 5.4.

This next chart shows the slowest, fastest and average times for each.  Lower is better.

magento-php-bar

The slowest time is not really all that interesting since every load test will have a few hickups.  I suspect that if I took the 95th percentile that it would look pretty close to the average.  But overall 5.4 and 5.5RC3 did better in all the data points that matter.

Now to get those bugs fixed so Magento can support those two…

Comments

EricHerrmann2

I don’t get it. What are the units?

Jun 10.2013 | 08:45 am

    kschroeder

    EricHerrmann2 Requests per second

    Jun 10.2013 | 08:46 am

edushyant

How do you enable magento to use opcache – Zend Optimizer+?  What i mean is do i have to put anything in /app/etc/local.xml or nothing. The reason I am asking is that for apc to work we have to add <cache <backend>apc</backend></cache> . Thanks

Jul 04.2013 | 03:57 pm

    kschroeder

    edushyant My test was just with the opcode cache and not the data cache and so no configuration in Magento was necessary.  That said, Optimizer+ from Zend Server had an APC compatibility layer built into it.  I believe it is still there but I don’t know offhand.

    Jul 04.2013 | 08:33 pm

PHP每次升级都升级了什么? | 东方网升技术中心

[…] 首先讲第一个方面:代码高效最简单的体现方式就是执行速度更快已经内存占用更小,我没有实际接触过这两方面的benchmark。但是根据网上得来的评价[1] [2] [3]来看:PHP的每一个升级版本相比于上一个版本都是有轻微的性能提升,无论是在执行速度上还是内存占用上。 […]

Aug 12.2013 | 06:17 am

MAGENTO: La manera correcta. | Blog de Magento en español

[…] mejor desempeño de aplicaciones usa PHP versión >= 5.4. Aquí hay algunos puntos de referencia benchmarks y el ultimo 5.4 parche de […]

Mar 04.2015 | 10:36 pm

PHP 5.5 räumt im Magento-Benchmark ab - entwickler.de

[…] Gemessen wurde der Durchsatz pro Sekunde sowie die durchschnittliche Ladezeit. Das Testsystem war ein ungecachetes Magento Enterprise 1.13 mit vier gleichzeitigen Sitzungen – für jede CPU eine. Die Anfragen waren relativ komplex, sodass sich zeigen musste, wie schnell PHP dieselben abarbeiten kann. Die Graphen findet Ihr im Blog-Posting. […]

May 05.2015 | 07:14 am

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.