Download - Magento Performance Optimization
-
7/27/2019 Magento Performance Optimization
1/25
Magento
eCommerce
Performance
Optimization
Ashish PurohitRanosys Technologies Pte Ltd
30 Apr 2013
-
7/27/2019 Magento Performance Optimization
2/25
What we will discuss today?
What is Magento?
Comparison with other eCommerce platform
What people think about Magento?
Performance optimization
Tools and utilities
-
7/27/2019 Magento Performance Optimization
3/25
What is
Magento
?
Open source rich eCommerce platform developed on PHP Zendframework
First stable release in 2008 by Varian now known as Magento
Comes in three variant
Community edition Magento GoMagento hosted solution Enterprise edition
Acquired by eBay in 2011
More than 4 million downloads after first stable release
Flexible Extendable Modular Upgradable Scalable
-
7/27/2019 Magento Performance Optimization
4/25
Comparison with other platform
-
7/27/2019 Magento Performance Optimization
5/25
Comparison with other platform
Magento is leader in this domain.
-
7/27/2019 Magento Performance Optimization
6/25
What people think about
Magento
?
User experience is leggy.
-
7/27/2019 Magento Performance Optimization
7/25
Truth behind it
Magento is resource intensive
Magento is based on EAV database model means to retrieve a singleinformation we need to go through many queries and tables.
Giant XML trees in memory and then "querying" those same trees forinformation. 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 diskand oneach 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 determineif an original class file or an override class files is needed. This adds up.
-
7/27/2019 Magento Performance Optimization
8/25
-
7/27/2019 Magento Performance Optimization
9/25
Optimization through Magentoconfiguration
.htaccess configuration
Web server and browserconfiguration
MySQL configuration
Solutions
-
7/27/2019 Magento Performance Optimization
10/25
Optimization through Magento configuration
Use flat catalog navigation.
Using this, we address EAV data model issue for running multiplequeries.
When enabled, it store products and category information inone table for each.
It is recommended to use flat category navigation in allMagento website
Flat product navigation will be helpful when you have more than1000 SKUs
-
7/27/2019 Magento Performance Optimization
11/25
Optimization through Magento configuration
How to enable flat catalog navigation?
System->Configuration->Catalog {Frontend option}
-
7/27/2019 Magento Performance Optimization
12/25
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 HTTPrequests.
Important: While enabling this feature you may face issue ofJavascript confliction when multiple JS frameworks used.
-
7/27/2019 Magento Performance Optimization
13/25
Optimization through Magento configuration
How to merge JS and CSS files?
System->Configuration->Developer {JS, CSS settings}
-
7/27/2019 Magento Performance Optimization
14/25
Optimization through Magento configuration
Compile Magento.
Using this option, we address issue of loading large framework inbackground by running through multiple directory structure.
When enabled, it merge various PHP files into one large file andstore them on location includes/src. Therefore instead ofreading multiple directories on entry point it will look at onlylocation.
It improves Magento performance by 25-40%.
Important: Once enabled, you cant upgrade Magento storeand modify any core settings including core files. If you want todo then decompile Magento first and modify it.
-
7/27/2019 Magento Performance Optimization
15/25
Optimization through Magento configuration
How to compile Magento?
System->Tools->Compilation
-
7/27/2019 Magento Performance Optimization
16/25
Optimization through Magento configuration
Disable Magento logs
Using this option, we address issues consuming more CPU cycleand diskspace.
When enabled, Magento stops writing logs for any error orexception. If any time needed for debugging then we canenable it again.
-
7/27/2019 Magento Performance Optimization
17/25
Optimization through Magento configuration
How to disable logs?
System -> Configuration -> Advanced -> Developer {Log Settings}
-
7/27/2019 Magento Performance Optimization
18/25
Optimization through Magento configuration
Enable Magento cache
System -> Cache Management
Helps in loading website faster
-
7/27/2019 Magento Performance Optimization
19/25
.HTACCESS tweaks
Enable gzip compression
AddOutputFilterByType DEFLATE text/html text/plain text/xmltext/css text/javascriptBrowserMatch ^Mozilla/4 gzip-only-text/htmlBrowserMatch ^Mozilla/4\.0[678] no-gzipSetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
Use header expires
ExpiresActive OnExpiresDefault access plus 1 month
ExpiresByType image/x-icon access plus 1 monthExpiresByType text/html access plus 1 monthExpiresByType image/plain access plus 1 monthExpiresByType image/css access plus 1 monthExpiresByType application/x-javascript access plus 1 monthExpiresByType application/x-shockwave-flash access plus 1month
-
7/27/2019 Magento Performance Optimization
20/25
.HTACCESS tweaks
Enable Apache KeepAlive and disable EtagFileEtag None
KeepAlive OnMaxKeepAliveRequests 100KeepAliveTimeOut 5
-
7/27/2019 Magento Performance Optimization
21/25
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.
-
7/27/2019 Magento Performance Optimization
22/25
MySQL configuration
Increase InnoDB buffer pool - Magento uses InnoDB storage enginewhich, uses memory pools to cache tables data, indexes to reduce
disk I/O. Less disk I/O means faster access to data, indexes etc. Thekey 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 togive concurrent connection. The key is to use this ability to boostconcurrent connections. Magento recommends to calculateinnodb_thread_concurrency value by equation
innodb_thread_concurrency = 2 x [# of CPUs] + 2
-
7/27/2019 Magento Performance Optimization
23/25
MySQL configuration
Enable query cache - MySQL can cache results for queries and returnit from cache, when identical query is done. For example queries
running for home page will be almost identical for another homepage view. Enabling the cache can save a lot of rework on MySQLend.
query_cache_size = 32M
Enable sort buffer
sort_buffer_size = 4M
-
7/27/2019 Magento Performance Optimization
24/25
Performance measuring & optimization tools
Magento speed testerURL - http://www.magespeedtest.com
Speed monitoringURL - http://mon.itor.us/
URL - http://www.pingdom.com/
Fooman SpeedsterFor combining, compressing and caching JS
and CSS files.URL - http://www.magentocommerce.com/magento-
connect/FOOMAN/extension/457/fooman-speedster
Page cachewith full page cache which is by default notavailable in community edition of Magento.
URL - http://www.magentocommerce.com/magento-connect/pagecache-powered-by-varnish.html
http://www.magespeedtest.com/http://www.magespeedtest.com/http://mon.itor.us/http://www.pingdom.com/http://www.magentocommerce.com/magento-connect/FOOMAN/extension/457/fooman-speedsterhttp://www.magentocommerce.com/magento-connect/FOOMAN/extension/457/fooman-speedsterhttp://www.magentocommerce.com/magento-connect/FOOMAN/extension/457/fooman-speedsterhttp://www.magentocommerce.com/magento-connect/FOOMAN/extension/457/fooman-speedsterhttp://www.magentocommerce.com/magento-connect/pagecache-powered-by-varnish.htmlhttp://www.magentocommerce.com/magento-connect/pagecache-powered-by-varnish.htmlhttp://www.magentocommerce.com/magento-connect/pagecache-powered-by-varnish.htmlhttp://www.magentocommerce.com/magento-connect/pagecache-powered-by-varnish.htmlhttp://www.magentocommerce.com/magento-connect/FOOMAN/extension/457/fooman-speedsterhttp://www.pingdom.com/http://mon.itor.us/http://www.magespeedtest.com/ -
7/27/2019 Magento Performance Optimization
25/25
Q&A
Email: [email protected]: http://sg.linkedin.com/in/ashishpurohitin
mailto:[email protected]://sg.linkedin.com/in/ashishpurohitinhttp://sg.linkedin.com/in/ashishpurohitinmailto:[email protected]