© All rights reserved. Zend Technologies, Inc.
Performance, High Availability, and Scalability of Magento using Zend Serverby Enrico ZimuelSenior Consultant & ArchitectZend Technologies
© All rights reserved. Zend Technologies, Inc.
About me● Senior Consultant and Architect at Zend
Technologies since 2008
● Software Engineer since 1996: C/C++, Java, PHP, Perl, VB/C#/ASP.NET, JavaScript
● More than 10 years of experience in PHP
● International speaker at web conferences: PHPCon, PHP Barcelona Conference, PHPDay, ZendCon, etc
● B.Sc. (Hons) in Economics and Computer Science
● Blog on web dev't: http://www.zimuel.it/blog
© All rights reserved. Zend Technologies, Inc.
Summary
● What is Magento?
● What is Zend Server?
● How to optimize the performance of Magento using Zend Server
● Zend Server Cluster Manager
● High availability and scalability of Magento using Zend Server Cluster Manager
© All rights reserved. Zend Technologies, Inc.
What is Magento?● An open source feature-rich eCommerce platform
● Developed in PHP with Zend Framework
● First stable release March 2008
● Main features:
▶ Flexible▶ Extendable▶ Modular▶ Upgradable▶ Scalable
http://www.magentocommerce.com
© All rights reserved. Zend Technologies, Inc.
Magento flavors● Magento Community
▶ Free to download and use
● Magento Professional▶ Annual subscription version
▶ Supported by Magento Solution Partners
▶ Warranty included
● Magento Enterprise ▶ Annual subscription version
▶ World class support (SLA)
▶ Additional feature set
▶ Warranty included
© All rights reserved. Zend Technologies, Inc.
What is Zend Server?● Production ready, complete
PHP application stack
● Application monitoring and problem diagnostics
● Multi-level performance enhancement capabilities
● Cluster management, High Availability, Scalable
● Technical support, software updates and security hot fixes http://www.zend.com/server/
© All rights reserved. Zend Technologies, Inc.
Zend Server flavors● Zend Server Community Edition
▶ Free to download and use
▶ Zend Optimizer+ (PHP accelerator)
▶ Zend Data Cache
▶ Java Bridge
● Zend Server▶ Annual subscription version
▶ World class support (SLA)
▶ Additional feature set: Monitoring, Code Tracing, Job Queue, Page Caching, etc
▶ Software updates and security hot fixes
© All rights reserved. Zend Technologies, Inc.
Zend Server flavors (2)
● Zend Server Cluster Manager▶ Annual subscription version
▶ World class support (SLA)
▶ Additional feature set: Monitoring, Code Tracing, Job Queue, Page Caching, etc
▶ Cluster Manager
▶ Session Clustering
▶ High availability
▶ Scalable architecture
▶ Software updates and security hot fixes
© All rights reserved. Zend Technologies, Inc.
Getting better performance from Magento
● Magento optimization▶ Magento Native Cache
▶ Magento Compilation Module
● Running Magento on Zend Server▶ PHP opcode accelerator (Zend Optimizer+)
▶ Zend Server Data Cache
▶ Zend Server Page Caching
▶ Diagnosing performance problems
© All rights reserved. Zend Technologies, Inc.
Magento native cache
● Magento uses Zend_Cache (Zend Framework class) for data caching
● Supported backends modules:
▶ File
▶ APC
▶ eAccelerator
● File system backend (default)
● Cache backend model specified in app/etc/local.xml
● Cache configuration examples can be found inapp/etc/local.xml.additional
●
▶ memcached
▶ Zend Server
▶ etc
© All rights reserved. Zend Technologies, Inc.
Major cached entities
● Configuration
● Page Layouts
● HTML Blocks (top navigation, footer, etc)
● Translations
● Data collections (website collection, store collection, store view collection, etc)
© All rights reserved. Zend Technologies, Inc.
Magento compilation module
● Goal: decrease number of file system operations (I/O)
● By default Magento uses 4 additional directories in include_path in the following order:
▶ app/code/local▶ app/code/community▶ app/code/core▶ lib
● This schema provides extensibility and flexibility and allows to fully rewrite code of some classes but yet keeps upgradability
© All rights reserved. Zend Technologies, Inc.
Magento compilation module: process
● Copy all the php files to the 4 dirs into one folder (include/src) and declare one directory for include_path. This step give 10-25% improvemente in performance.
● Aggregate code of most used php classes to “scope include” files.
▶ For instance Varien_Object, Mage_Core_Model_Abstract, Zend_Cache are included in every request. The classes are aggregated to the “default scope include” file.
● Note: compilation needs to be disabled when upgrading or developing and should be enabled in production
© All rights reserved. Zend Technologies, Inc.
Zend Optimizer+: PHP opcode accelerator
● Caching compiled PHP opcode in shared memory
● Automatically enabled when you run PHP applications using Zend Server
● Usually provide a very significant performance boost
© All rights reserved. Zend Technologies, Inc.
Zend Server Page Caching
● Caches entire HTTP response
● The rule caching is based on different parameters: URL, $_SESSION, $_SERVER, $_GET, $_COOKIE
● Performance gains are usually very high
● Typically doesn't require code changes
© All rights reserved. Zend Technologies, Inc.
Diagnosing performance problems
● Bult-in application monitoring alerts on script execution slowdowns
● Problem diagnostics enables quick problem isolation
● Code-level profiling and analysis performed with:
▶ Code Tracing▶ Integration with Zend Studio
© All rights reserved. Zend Technologies, Inc.
Zend Server Cluster Manager
● Zend Server Cluster Manager extends the benefits of Zend Server across large-scale PHP deployments
● With Zend Server Cluster Manager you can implement solutions of:
▶ High Availability▶ Scalability ▶ Central management
© All rights reserved. Zend Technologies, Inc.
Zend Server Cluster Manager architecture
Load Balancer
MySQL
Firewall
© All rights reserved. Zend Technologies, Inc.
High availability and Scalability
of Magento using Zend Server Cluster Manager
© All rights reserved. Zend Technologies, Inc.
Magento session handlers
● Magento supports different PHP session handlers:▶ file
▶ eaccelerator
▶ memcached
▶ db
● Right now, the version 1.4 of Magento doesn't support the session clustering of Zend Server but there is a patch to enable the session cluster:
http://arr.gr/magento/magento-1.4-trunk-r69862-issue-23361-01.patch
● This patch will be included in the future version of Magento
© All rights reserved. Zend Technologies, Inc.
The patch
● Edit the file app/code/core/Mage/Core/Model/Session/Abstract/Varien.php
● Add the following lines (with +):▶ @@ -59,6 +59,11 @@
case 'eaccelerator': ini_set('session.save_handler', 'eaccelerator'); break;++ case 'cluster':+ ini_set('session.save_handler', 'cluster');+ break;+ default: session_module_name('files'); if (is_writable(Mage::getBaseDir('session'))) {
© All rights reserved. Zend Technologies, Inc.
High Availability and Scalability for Magento
● Using Zend Server Cluster Manager you can implement an high availability and scalability architecture for Magento
● For a Magento ecommerce web sites the advantages using Zend Server Cluster Manager are:
▶ High availability = Never loose customers
▶ Scalability = Increment the number of customers
▶ Central management = Better support to the customers
© All rights reserved. Zend Technologies, Inc.
Thank you!
More info:http://www.zend.comhttp://www.magentocommerce.com