0% found this document useful (0 votes)
231 views

Magento Performance Optimization

This document discusses Magento eCommerce performance optimization. It provides an overview of Magento, compares it to other platforms, and discusses common performance issues. It then outlines several approaches to optimize Magento performance, including configuration tweaks, .htaccess modifications, web server/browser configuration, MySQL configuration, and tools for measuring and improving performance. Specific recommendations are provided around enabling flat catalog navigation, merging CSS/JS, enabling caching, and optimizing database settings.

Uploaded by

emiliandragan
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
231 views

Magento Performance Optimization

This document discusses Magento eCommerce performance optimization. It provides an overview of Magento, compares it to other platforms, and discusses common performance issues. It then outlines several approaches to optimize Magento performance, including configuration tweaks, .htaccess modifications, web server/browser configuration, MySQL configuration, and tools for measuring and improving performance. Specific recommendations are provided around enabling flat catalog navigation, merging CSS/JS, enabling caching, and optimizing database settings.

Uploaded by

emiliandragan
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 25

Magento eCommerce Performance Optimization

Ashish Purohit Ranosys Technologies Pte Ltd

30 Apr 2013

What we will discuss today?

What is Magento? Comparison with other eCommerce platform What people think about Magento?

Performance optimization
Tools and utilities

What is Magento?

Open source rich eCommerce platform developed on PHP Zend framework First stable release in 2008 by Varian now known as Magento Comes in three variant Community edition Magento Go Magento hosted solution Enterprise edition Acquired by eBay in 2011 More than 4 million downloads after first stable release
Flexible Upgradable Scalable

Extendable

Modular

Comparison with other platform

Comparison with other platform

Magento is leader in this domain.

What people think about Magento?


User experience is leggy.

Truth behind it
Magento is resource intensive

Magento is based on EAV database model means to retrieve a single information we need to go through many queries and tables.
Giant XML trees in memory and then "querying" those same trees for information. This takes both memory (storing the trees) and CPU (parsing the trees). Some of these (especially the layout tree) are huge. Also, unless caching is on, these tree are built up from files on disk and on each request. Magento uses its configuration system to allow you to override classes. This is a powerful feature, but it means anytime a model, helper, or controller is instantiated, extra PHP instructions need to run to determine if an original class file or an override class files is needed. This adds up.

Solution
Understand critical parameters for making optimization strategy
Identify the server resources available. Type of hosting server, Web server, RAM, CPU etc Product catalog Number of categories, products etc Number of expected simultaneous users

Optimization methods are available/ applicable depending upon the nature of web server and Magento store

Solutions

Optimization through Magento configuration

.htaccess configuration

Web server and browser configuration

MySQL configuration

Optimization through Magento configuration

Use flat catalog navigation.


Using this, we address EAV data model issue for running multiple queries.

When enabled, it store products and category information in one table for each.
It is recommended to use flat category navigation in all Magento website Flat product navigation will be helpful when you have more than 1000 SKUs

Optimization through Magento configuration

How to enable flat catalog navigation?


System->Configuration->Catalog {Frontend option}

Optimization through Magento configuration

Merge JS and CSS files. Using this option, we address issue of multiple HTTP requests. When enabled, it merge all JS and CSS files and reduce HTTP requests. Important: While enabling this feature you may face issue of Javascript confliction when multiple JS frameworks used.

Optimization through Magento configuration

How to merge JS and CSS files?


System->Configuration->Developer {JS, CSS settings}

Optimization through Magento configuration

Compile Magento. Using this option, we address issue of loading large framework in background by running through multiple directory structure. When enabled, it merge various PHP files into one large file and store them on location includes/src. Therefore instead of reading multiple directories on entry point it will look at only location. It improves Magento performance by 25-40%. Important: Once enabled, you cant upgrade Magento store and modify any core settings including core files. If you want to do then decompile Magento first and modify it.

Optimization through Magento configuration

How to compile Magento?


System->Tools->Compilation

Optimization through Magento configuration

Disable Magento logs Using this option, we address issues consuming more CPU cycle and diskspace. When enabled, Magento stops writing logs for any error or exception. If any time needed for debugging then we can enable it again.

Optimization through Magento configuration

How to disable logs?


System -> Configuration -> Advanced -> Developer {Log Settings}

Optimization through Magento configuration

Enable Magento cache


System -> Cache Management

Helps in loading website faster

.HTACCESS tweaks
Enable gzip compression
<IfModule mod_deflate.c> AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript BrowserMatch ^Mozilla/4 gzip-only-text/html BrowserMatch ^Mozilla/4\.0[678] no-gzip SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dontvary </IfModule>

Use header expires

<IfModule mod_expires.c> ExpiresActive On ExpiresDefault access plus 1 month ExpiresByType image/x-icon access plus 1 month ExpiresByType text/html access plus 1 month ExpiresByType image/plain access plus 1 month ExpiresByType image/css access plus 1 month ExpiresByType application/x-javascript access plus 1 month ExpiresByType application/x-shockwave-flash access plus 1 month </IfModule>

.HTACCESS tweaks
Enable Apache KeepAlive and disable Etag
FileEtag None KeepAlive On MaxKeepAliveRequests 100 KeepAliveTimeOut 5

Web server and browser configuration


Use Varnish Cache.

Use PHP cache accelerator like APC, eAccelerator, Xcache.


Use CDN to deliver static contents of your websites. Do not use too many external sources for images, iframes. Install only minimum required modules on server. Deploy on Nginx or Litespeed server.

It is recommended not to use Magento on cheap hosting.

MySQL configuration
Increase InnoDB buffer pool - Magento uses InnoDB storage engine which, uses memory pools to cache tables data, indexes to reduce disk I/O. Less disk I/O means faster access to data, indexes etc. The key is to assign as much memory as possible for in-memory cache.
innodb_buffer_pool_size = 512M

Multithreading - Innodb can use multiple cores of server processors to give concurrent connection. The key is to use this ability to boost concurrent connections. Magento recommends to calculate innodb_thread_concurrency value by equation
innodb_thread_concurrency = 2 x [# of CPUs] + 2

MySQL configuration
Enable query cache - MySQL can cache results for queries and return it from cache, when identical query is done. For example queries running for home page will be almost identical for another home page view. Enabling the cache can save a lot of rework on MySQL end.
query_cache_size = 32M

Enable sort buffer


sort_buffer_size = 4M

Performance measuring & optimization tools


Magento speed tester Speed monitoring

URL - http://www.magespeedtest.com URL - http://mon.itor.us/ URL - http://www.pingdom.com/

Fooman Speedster For combining, compressing and caching JS and CSS files.
URL - http://www.magentocommerce.com/magentoconnect/FOOMAN/extension/457/fooman-speedster

Page cache with full page cache which is by default not available in community edition of Magento.
URL - http://www.magentocommerce.com/magentoconnect/pagecache-powered-by-varnish.html

Q&A

Email: [email protected] Linkedin: http://sg.linkedin.com/in/ashishpurohitin

You might also like