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

Table of Content

Magento 1 and 2 speed comparison on PHP 5 and PHP 7
Posted in: Magento 2 Guides

PHP 7.1.0 WAS RELEASED A COUPLE OF WEEKS BEFORE. ALL THE VERSIONS OF PHP LOWER THAN 5.6.X WERE ANNOUNCED AS OUTDATED AND ARE NOT SUPPORTED BY THE DEVELOPERS. SOME DISTRIBUTION VENDORS STILL SUPPORT SECURITY UPDATES IN TERMS OF LONG TERM SUPPORT, BUT YOU’LL NEVER GET THE NEW FEATURES WITH THEM. 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 Magento 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

Software
  • 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 1.9.3.1 with sample-data
  • EE 1.14.2.1 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 1.14.2.1. [php]</pre> --- 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]}(); } <pre>[/php] 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 1.14.2.1 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/magento2ce.mage-php70.amasty.net/public_html/vendor/magento/framework/Encryption/Crypt.php 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/magento2ce.mage-php70.amasty.net/public_html/vendor/magento/module-sales/Controller/Adminhtml/Order/Invoice/Void.php 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 something went wrong with the settings, use Magento actions history in future to see the log and restore recent changes when needed.
December 21, 2016
January 11, 2017
October 24, 2016
Comments
Blackbird Agency
January 3, 2017
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)
Reply
Ksenia Dobreva
January 5, 2017
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!
Apke
January 4, 2017
@Blackbird are you serious? they testet Magento not a Page-Cache
Reply
Rafael Corrêa Gomes
January 4, 2017
Thanks for sharing
Reply
Ksenia Dobreva
January 5, 2017
thanks for reading!
Blackbird Agency
January 4, 2017
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.
Reply
Ksenia Dobreva
January 5, 2017
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.
Bob
January 5, 2017
+1 @Blackbird please clarify if Varnish was enabled on EE 2
Reply
Ksenia Dobreva
January 5, 2017
No, it wasn't.
PAUL WALLACE
January 11, 2017
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 ?
Reply
Ksenia Dobreva
January 12, 2017
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.
DrCard
January 13, 2017
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 ?
Reply
Ksenia Dobreva
January 13, 2017
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
January 13, 2017
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
January 17, 2017
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!
Jehzeel Laurente
May 5, 2019
Have you tried comparing Magento 1.9.4 vs 2.3? Both are now PHP 7 supported. Locally, 1.9.4 is way faster than 2.3. But maybe your test results are different.
Reply
Jehzeel Laurente
May 5, 2019
And oh, Im currently using PHP 7.3 + Magento 1.9.4.1 which is incredibly fast even if caching is turned off. When I tried 2.3 in the same server using PHP 7.3, it's incredibly slow. I wonder why O_O
Reply
Alina Bragina
May 17, 2019
Hi Jehzee, you see we need more technical details to make sense of the case. So, feel free to pose your question to our <a href="https://amasty.com/contacts/" rel="nofollow">support</a> team or find any relevant info in our <a href="https://amasty.com/knowledge-base/" rel="nofollow">FAQ</a>.
Rajeev Dave
May 24, 2019
Hey Amasty Team! Thanks for sharing Magento speed optimization articles. it's really useful to boost up SEO Prospective online store. I have implemented this strategy which you provide in article really great stuff! Thanks for sharing the great article!
Reply
Alina Bragina
May 24, 2019
Hey Rajeev, we're happy our article is of use to you, thanks!
Leave your comment

Your email address will not be published

This blog was created with Amasty Blog Pro

This blog was created with Amasty Blog Pro

© 2009-2024 Amasty. All Rights Reserved.