Magento 1 & Magento 2 speed comparison on PHP 5.6.27, PHP 7.0.13, and PHP 7.1.0

Magento 1 and 2 speed comparison on PHP 5 and PHP 7


Hello, Amasty blog readers!

We’ve been posting Magento performance tests for quite a while. For the last couple of months, our readers were asking us to test Magento 1 and 2 performance with the new PHP versions. And that day has come!

Why we are testing Magento speed again

Why are we testing Magento 1 and Magento 2 to check the speed and performance depending on different factors?

Site speed and performance is a crucial factor for e-commerce, both when it comes to SEO opportunities and customers behavior.

Despite the fact that PHP 7 adds more than 50% to site’s performance in general, still a significant number of Magento stores are using the old version of PHP. To stimulate shop owners to switch to faster options, we have compared different Magento versions performance on various PHP versions.

Also, this information can be useful for all the people who are working with Magento – agencies, developers, SEO specialists and the Magento community in general.

What we used to test Magento performance

  • Debian 8.6 (64-bit) distribution kit
  • Apache 2.4.10
  • Percona Server 5.6.33
  • PHP 5.6.27, PHP 7.0.13, PHP 7.1.0
Magento versions
  • CE with sample-data
  • EE with sample-data
  • CE 2.1.2 (the data was generated via performance-toolkit, medium.xml profile)
  • EE 2.1.1 (the data was generated via performance-toolkit, medium.xml profile)

*With Magento 1.x compilation was turned on, with Magento 2.x production mode was on, too.

Server (a virtual machine)
  • 4 CPU cores
  • 8GB RAM
  • SSD storage

* this configuration is recommended by Amasty as a starter kit for running a Magento store.

Magento 1.x and PHP 7

As Magento 1.x does not officially support PHP 7, we applied a simple patch for EE

--- app/code/core/Mage/Core/Model/Layout.php.orig      2016-12-01 09:09:13.392844463 +0000

+++ app/code/core/Mage/Core/Model/Layout.php   2016-12-01 09:08:36.516177798 +0000

@@ -552,7 +552,7 @@

$out = '';

if (!empty($this->_output)) {

foreach ($this->_output as $callback) {

-                $out .= $this->getBlock($callback[0])->$callback[1]();

+                $out .= $this->getBlock($callback[0])->{$callback[1]}();


Note: this patch is not a complete solution to run Magento 1 on PHP 7 and is not recommended for usage on a production store. However, this version is enough for running the tests.

Magento performance testing scenario

Performance testing used the following scenario with Apache jMeter 3.1:

  • Homepage loading
  • Category page loading
  • Performing search
  • Product page loading

Some details of the test

  1. 5 threads are run simultaneously, each of them has 100 loops total. In this test, we don’t do load testing and we do not compare different versions of Magento. The main goal of this test is to see the speed of certain actions on various PHP versions.
  2. For Magento 2.x versions, I am using a built-in performance-toolkit for generating products, customers, orders, and such.
    php bin/magento setup:performance:generate-fixtures vendor/magento/magento2-base/setup/performance-toolkit/profiles/ce/medium.xml
  3. jMeter is run in headless mode on the same server where Magento is installed. It allows us to avoid network delays influence on the test results.

Test results: data and diargams

Values in the table are the average server response time in milliseconds.

Magento CE 1.93.1 on PHP5 and PHP7 speed comparison

Magento CE 2.1.2 on PHP5 and PHP7 speed comparison

Magento EE on PHP5 and PHP7 speed comparison

Magento EE 2-1-1 on PHP5 and PHP7 speed comparison

Dissecting the test results

Apart from the results that do not need to be commented, here are some additional thoughts I would like to point out:

  • Using PHP 7.0.13 instead of PHP 5.6.27 adds more than 50% to Magento 2.x performance. In other words, if you have your Magento 2 store on a server with PHP 5, you’re losing a lot of opportunities better speed offers you in the world of e-commerce.
  • A clean Magento 2.x didn’t run on PHP 7.1.0, because it uses mcrypt extension, which was declared as deprecated in PHP 7.1. The result is a fatal error Deprecated Functionality: Function mcrypt_module_open() is deprecated in /var/www/vhosts/ on line 54. To avoid this error, I had to edit app/bootstrap.php and set «error_reporting(0);». Also on PHP 7.1.0, after the compilation php bin/magento setup:di:compile attempt an error appeared: PHP Fatal error: Cannot use ‘Void’ as class name as it is reserved in /var/www/vhosts/ on line 9. To avoid this one, I compiled on PHP 7.0.13, but the compiled code was run on PHP 7.1.0.
  • PHP 7.1.0 speed/performance results are almost the same if compared to PHP 7.0.13, with a little bit back and forth on both sides. As Magento 2.x still doesn’t support PHP 7.1.x officially, we don’t recommend this pairing on a production site right now.
  • The latest Magento CE 1.x runs on PHP 7, but I didn’t have a chance to test all the functionality, and also there’s no guarantee that third party extensions will work on PHP 7 as well. If you decide to use this pairing, please do test the changes on a staging version of your Magento shop.

If you need to see the detailed results, you are welcome to download the PDF with all the data included:

Download research PDF for free

Andrey Tataranovich

Andrey Tataranovich

Andrei believes that only at work people can fully express themselves, so he does his best to implement all his knowledge while in the office. Having made computer science his hobby, Andrei is constantly developing his professional skills. But despite such a busy schedule he always finds time to read science fiction books and communicate with new interesting people.

You may also like...

15 Responses

  1. Blackbird Agency says:

    Hey Amasty team!
    Did you configure the default Varnish cache system for M2 for these tests?

    Thank you for this precision, because it would probably optimize speed for pages in cache (e.g. homepage)

    • Ksenia Dobreva Ksenia Dobreva says:

      Hey there and thanks for reading!

      As for your question, we didn’t use Varnish on purpose to check Magento speed on various PHP versions, but not Magento speed in general. Cheers!

  2. Apke says:

    @Blackbird are you serious? they testet Magento not a Page-Cache

  3. Rafael Corrêa Gomes says:

    Thanks for sharing

  4. Blackbird Agency says:

    I really like the different graphs they did. I just want to know how to compare them.
    Some of the tests on M1 are done with Amasty FPC (which works very well by the way), but on M2, we don’t have the information about the FPC configuration.

    • Ksenia Dobreva Ksenia Dobreva says:

      We used our FPC in some tests because we also wanted to check Amasty FPC performance with various PHP versions (consider it as a separate test which we did simultaneously for convenience).
      But, as we said above, it wasn’t our purpose to check Varnish performance, that’s another kind of a test.

  5. Bob says:

    +1 @Blackbird please clarify if Varnish was enabled on EE 2

  6. PAUL WALLACE says:

    So if I didnt want to upgrade from 1.8.1 to 2.1.1 is it possible then just to upgrade the php from 5.6 to 7.0 or 7.1 ?

    • Ksenia Dobreva Ksenia Dobreva says:

      Thanks for the question, Paul.

      Officially, there’s no support and no guarantee, that M1 will be working on PHP 7.0.x and higher. But in reality after some work it’s possible to get M1 1.9.x going on PHP 7.0.x with no issues – from our experience. Our extensions are compatible with PHP7, but any other custom extension is a potential issue and we can’t promise anything about third party modules.

      Hope that helps.

  7. DrCard says:

    Thank you so much for the graphs and tests , as it shows that magento 1 EE is the fastest of them all so , why every one says that magento 2 is faster !!!! i have check all the files and js in both ,you get more the 1.2 mb just to load a page in magento 2 while the same page on magento 1 is 650 kb , is there an answer why all the bolgs and magento team say magento 2 is faster ?

    • Ksenia Dobreva Ksenia Dobreva says:

      Thanks for reading!
      In short, because there are many other ifs in this question.
      For example, on a browser’s side with cache M2 can be faster than M1, but we didn’t test that, because it won’t be about PHP (and our test was about PHP). Also, EE is not an option for most small and middle-sized businesses, and they have to choose from more affordable variants.

      • DrCard says:

        Thank you for the fast answer , i hope the next test Amastry will do is a megento browser performance and caching test, i still think if you setup magento 1 correctly it will be faster in response time and size of the total page, migrating to magento 2 at this time will be a wrong choice, this is what i found out .
        i installed and tested M2, i couldn’t get it faster then M1 ,even after minifying and merging all the files ,also i tested all sites that i could find online that are M2 i couldn’t see one that is faster then the M1 with full FPC .

        so what do you think Ksenia about this subject .

        • Ksenia Dobreva Ksenia Dobreva says:

          Thanks for sharing your experience! Yes, we have certain plans for performing these tests in the future. Maybe with the next version – we’ll see. Thanks for your interest!

Leave a Reply

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