Magento在php7下速度测试

简介:

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


目录
相关文章
原生php实现列表接口+分页接口+排序接口组合使用+包括测试数据(不加任何封装)
原生php实现列表接口+分页接口+排序接口组合使用+包括测试数据(不加任何封装)
原生php实现列表接口+分页接口+排序接口组合使用+包括测试数据(不加任何封装)
|
3天前
|
设计模式 人工智能 算法
PHP中的设计模式:策略模式的深入解析与实践软件测试中的人工智能革命:提升效率与准确性的新篇章
在PHP开发中,理解并运用设计模式是提升代码质量和可维护性的重要途径。本文聚焦于策略模式(Strategy Pattern),一种行为型设计模式,它允许在运行时选择算法或业务规则。通过本文,我们将深入探讨策略模式的定义、结构、使用场景以及如何在PHP项目中有效地实现和利用策略模式。不同于性能优化等技术性摘要,本文着重于提供对策略模式全面而实用的理解,助力开发者编写出更加灵活和可扩展的应用程序。 本文深入探讨了人工智能在软件测试领域的应用,揭示了其如何显著提高测试过程的效率和准确性。通过实际案例分析,展示了AI技术在自动化测试、缺陷检测及结果分析中的关键作用,并讨论了实施AI测试策略时面临的挑
14 3
|
2月前
|
测试技术 PHP 开发者
原生php单元测试示例
通过上面的示例,我们可以看到,即使在缺乏专门测试框架的情况下,使用原生PHP代码进行基本的单元测试也是完全可行的。当然,对于更复杂的项目,利用像PHPUnit这样的专业工具将带来更多的便利和高级功能。不过,理解单元测试的基本概念和能够手工编写测试是每个PHP开发者的宝贵技能。
30 4
|
2月前
|
测试技术 PHP 开发者
原生php单元测试示例
通过上面的示例,我们可以看到,即使在缺乏专门测试框架的情况下,使用原生PHP代码进行基本的单元测试也是完全可行的。当然,对于更复杂的项目,利用像PHPUnit这样的专业工具将带来更多的便利和高级功能。不过,理解单元测试的基本概念和能够手工编写测试是每个PHP开发者的宝贵技能。
17 1
|
2月前
|
数据库
基于PHP+MYSQL开发制作的趣味测试网站源码
基于PHP+MYSQL开发制作的趣味测试网站源码。可在后台提前设置好缘分, 自己手动在数据库里修改数据,数据库里有就会优先查询数据库的信息, 没设置的话第一次查询缘分都是非常好的 95-99,第二次查就比较差 , 所以如果要你女朋友查询你的名字觉得很好 那就得是她第一反应是查和你的缘分, 如果查的是别人,那不好意思,第二个可能是你。
49 3
|
2月前
|
测试技术 PHP 开发者
原生php单元测试示例
通过上面的示例,我们可以看到,即使在缺乏专门测试框架的情况下,使用原生PHP代码进行基本的单元测试也是完全可行的。当然,对于更复杂的项目,利用像PHPUnit这样的专业工具将带来更多的便利和高级功能。不过,理解单元测试的基本概念和能够手工编写测试是每个PHP开发者的宝贵技能。
15 0
|
PHP 数据库
对PHP源码的测试
对PHP源码的测试
|
JSON 监控 前端开发
Zabbix监控系统PHP-API开发测试实录
Zabbix监控系统PHP-API开发测试实录
214 0
|
PHP Windows
php环境部署:phpstudy设置本地测试域名找不到hosts文件的解决方案
php环境部署:phpstudy设置本地测试域名找不到hosts文件的解决方案
235 0