Top Banner
© All rights reserved. Zend Technologies, Inc. Performance, High Availability, and Scalability of Magento using Zend Server by Enrico Zimuel Senior Consultant & Architect Zend Technologies [email protected]
32

Costruire un sito e-commerce in alta affidabilità con Magento e Zend Server Cluster Manager

Jan 28, 2015

Download

Technology

Il business on-line stà diventando un fattore sempre più critico per le aziende. In particolare la realizzatione di siti di commercio elettronico che siano affidabili, con meccanismi di fault tolerant, sta diventando un'esigenza sempre più richiesta. In questo webinar verrà spiegato come creare un sito di commercio elettronico in alta affidabilità utilizzando Magento, un software PHP open source per lo sviluppo di applicazioni e-commerce e Zend Server Cluster Manager, l'application server PHP per la realizzazione di architetture web PHP in alta affidabilità.
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Costruire un sito e-commerce in alta affidabilità con Magento e Zend Server Cluster Manager

© All rights reserved. Zend Technologies, Inc.

Performance, High Availability, and Scalability of Magento using Zend Serverby Enrico ZimuelSenior Consultant & ArchitectZend Technologies

[email protected]

Page 2: Costruire un sito e-commerce in alta affidabilità con Magento e Zend Server Cluster Manager

© 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

Page 3: Costruire un sito e-commerce in alta affidabilità con Magento e Zend Server Cluster Manager

© 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

Page 4: Costruire un sito e-commerce in alta affidabilità con Magento e Zend Server Cluster Manager

© All rights reserved. Zend Technologies, Inc.

Magento

Page 5: Costruire un sito e-commerce in alta affidabilità con Magento e 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

Page 6: Costruire un sito e-commerce in alta affidabilità con Magento e Zend Server Cluster Manager

© 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

Page 7: Costruire un sito e-commerce in alta affidabilità con Magento e Zend Server Cluster Manager

© All rights reserved. Zend Technologies, Inc.

Zend Server

Page 8: Costruire un sito e-commerce in alta affidabilità con Magento e Zend Server Cluster Manager

© 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/

Page 9: Costruire un sito e-commerce in alta affidabilità con Magento e Zend Server Cluster Manager

© 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

Page 10: Costruire un sito e-commerce in alta affidabilità con Magento e Zend Server Cluster Manager

© 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

Page 11: Costruire un sito e-commerce in alta affidabilità con Magento e Zend Server Cluster Manager

© All rights reserved. Zend Technologies, Inc.

Performance improvement of Magento using

Zend Server

Page 12: Costruire un sito e-commerce in alta affidabilità con Magento e Zend Server Cluster Manager

© 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

Page 13: Costruire un sito e-commerce in alta affidabilità con Magento e Zend Server Cluster Manager

© 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

Page 14: Costruire un sito e-commerce in alta affidabilità con Magento e Zend Server Cluster Manager

© 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)

Page 15: Costruire un sito e-commerce in alta affidabilità con Magento e Zend Server Cluster Manager

© 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

Page 16: Costruire un sito e-commerce in alta affidabilità con Magento e Zend Server Cluster Manager

© 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

Page 17: Costruire un sito e-commerce in alta affidabilità con Magento e Zend Server Cluster Manager

© 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

Page 18: Costruire un sito e-commerce in alta affidabilità con Magento e Zend Server Cluster Manager

© 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

Page 19: Costruire un sito e-commerce in alta affidabilità con Magento e Zend Server Cluster Manager

© All rights reserved. Zend Technologies, Inc.

Example: cache /js/index.php

Page 20: Costruire un sito e-commerce in alta affidabilità con Magento e Zend Server Cluster Manager

© All rights reserved. Zend Technologies, Inc.

Real use case: Zend's online store

Page 21: Costruire un sito e-commerce in alta affidabilità con Magento e Zend Server Cluster Manager

© 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

Page 22: Costruire un sito e-commerce in alta affidabilità con Magento e Zend Server Cluster Manager

© All rights reserved. Zend Technologies, Inc.

Zend Server Cluster Manager

Page 23: Costruire un sito e-commerce in alta affidabilità con Magento e Zend Server Cluster Manager

© 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

Page 24: Costruire un sito e-commerce in alta affidabilità con Magento e Zend Server Cluster Manager

© All rights reserved. Zend Technologies, Inc.

Zend Server Cluster Manager architecture

Load Balancer

MySQL

Firewall

Page 25: Costruire un sito e-commerce in alta affidabilità con Magento e Zend Server Cluster Manager

© All rights reserved. Zend Technologies, Inc.

High availability: session cluster

Page 26: Costruire un sito e-commerce in alta affidabilità con Magento e Zend Server Cluster Manager

© All rights reserved. Zend Technologies, Inc.

High availability: session cluster (2)

Page 27: Costruire un sito e-commerce in alta affidabilità con Magento e Zend Server Cluster Manager

© All rights reserved. Zend Technologies, Inc.

High availability and Scalability

of Magento using Zend Server Cluster Manager

Page 28: Costruire un sito e-commerce in alta affidabilità con Magento e 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

Page 29: Costruire un sito e-commerce in alta affidabilità con Magento e Zend Server Cluster Manager

© 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'))) {

Page 30: Costruire un sito e-commerce in alta affidabilità con Magento e Zend Server Cluster Manager

© 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

Page 31: Costruire un sito e-commerce in alta affidabilità con Magento e Zend Server Cluster Manager

© All rights reserved. Zend Technologies, Inc.

Questions?

Page 32: Costruire un sito e-commerce in alta affidabilità con Magento e Zend Server Cluster Manager

© All rights reserved. Zend Technologies, Inc.

Thank you!

More info:http://www.zend.comhttp://www.magentocommerce.com