Magento在php7下速度测试

来源:互联网 发布:lol断开连接说网络不稳 编辑:程序博客网 时间:2024/05/22 12:52

Magento performance is a recurrent problem for all developers and store owners. But PHP 7 is coming and you should think about using it very soon, benchmark is amazing!

Introduction

PHP community is waiting for it since months and PHP 7 is now Release Candidate as I am writing this article. It means that you are already able to test it against all your PHP applications and report any bug you found. I won’t talk about all the awesome features coming but rather focus on its usage with Magento.

Magento is based on its own framework that is also based on the Zend Framework which make any request using hundreds of PHP files and lines of code. It has always been a problem and you have probably tried all the possible improvements such as FPC, Magento Compilation, PHP and OPcache tweaking, Varnish or anything else that would have relieved your Magento installation. It is still useful to use these solutions but you can now also consider using PHP 7 really soon. I have made some basic benchmarking with PHP 5.5, PHP 5.6 and PHP 7 on a fresh Magento 1.9.2.0 installation with sample data installed. Results are amazing!

Benchmarking Magento 1.9 and PHP 7 (with sample data)

I have made these tests on my own MacBook Pro from the terminal. Hardware don’t really matter here since tests are all ran on a same basis. I have called all the URLs of the Magento Demo Store 5 times with cURL requests and for each PHP version.

Here is the result:

PHP 5.5

Show Details

PHP 5.6

Show Details

PHP 7.0

Show Details

Make your own tests

A minor incompatibility has to be fixed before using Magento with PHP 7.

You have to modify the file app/code/core/Mage/Core/Model/Layout.php on line 555:

Modify the line so it looks like this:

$this->getBlock($callback[0])->{$callback[1]}();

Conlusion

PHP 7 is still in Release Candidate state and should not be used in any production website yet of course. But just be aware of the upcoming releases and go make your own tests. This version is going to revolutionize PHP usage and applications. Can’t wait testing it with Magento 2 ;)

原文地址:http://www.bubblecode.net/en/2015/07/24/magento-php-7/

注:1、原作者做这个测试的时候php7还不是正式版,现在php7正式版已经发布了

2、Magento1.9要正常在php7环境跑起来,需要修改Mage_Core_Model_Layout类的代码,不过这个仅仅是保证跑起来,不能保证所有功能细节在php7环境下都正常,需要做更多严密的测试,期待Magento官方过段时间能提供补丁包来支持php7

3、附上迁移PHP5.6到PHP7指南一份:https://github.com/laruence/Migrating-from-PHP5.6.x-to-PHP7.0.x


0 0