There are several reasons why speed is very important for websites. First of all visitors. They can become dissatisfied with slow performance and loose trust to your website. The second reason is web search ranking. Google is using site speed as a part of the whole process. These are obvious things and we are not going to talk about them. Instead we will talk about all possible tips and tricks to speed up your Magentoperformance.
Firsе of all you should find reliable and dedicated server.
The website should be hosted in the same country with your customers.
Try to remove all unnecessary files from your server.
Remember! You should install only necessary Apache modules.
In MySQL Admin repair & optimize all tables
Use a PHP accelerator. It can be ZendOptimizer+, APC, Xcache or something similar. APC – (http://pecl.php.net/package/APC). Apc should cache more data, so increased the APC.shm.size to 128. The same about Xcache (http://xcache.lighttpd.net/)
Use Apache mod_expires and set time for file caching. This is the example:
In htaccess, don’t forget to turn on Gzip Compression.
Also, to improve your Magento store performance you use mod_deflate or zlib.output_compression to compress output.
Another important detail is parallel transfer of static content. You should use a Content Delivery Network (CDN) for it. Several extension can be useful here, for example One Pica Image CDN.
Don’t forget that too many different external sources use extra time and create an extra dependency on other 3rd party servers, so the performance of your magento e-commerce store could be reduced.
Do everything to minimize redirects.
Errors are one of the main reasons of browser slowdown so make your output W3C compliant.
Turn on Apache KeepAlives. This will funnel multiple HTTP requests through a single TCP connection.
Take care of Swap Apache (for NginX or Litespeed).
If it is possible you can turn off web server logging, if not – reduces disk writes.
Instead of your OS’s package manager you can сompile MySQL from source. This will also speeds up your Magento e-commerce website
Another useful tip is to modify the configuration for your MySQL server. As a result, you should get better advantage of your server’s RAM.
You can also set ‘php_value memory_limit 128M’ in php configuration or add it to .htaccess file. This will provide you with the information about memory usage.
Remember, that memory-based filesystem is the best option for dynamic data. If you store it (var/cache, var/session) on tmpfs or RAMdisk, the disk I/O is decreased.
Furthermore, you can change realpath_cache_size in php.ini to get better performance from your e-commerce store.
If you are hardcore user you can work with memcache.
You can also disable the PHP open_basedir directive, if you know what are you doing, of course.
Don’t forget to upgrade to the latest Magento version.
And here is the trick for .htaccess files: eliminate their directory structure scans.
Moreover, try to keep up recommended innodb_buffer_pool_size: for combined web and db server with 6 GB RAM – 2-3 GB; for dedicated database server with 6GB RAM – 5 GB; for dedicated database server with 12 GB RAM – 10 GB.
Use 64MB for query_cache_size and 2MB for query_cache_limit
Don’t forget to use separate backend server for handling admin users, processing backend activity (cron), pre generating full page caching and handling media queries.
Use multiple frontend servers (web nodes) to handle browsing and checkout.
Use Varnish reverse proxy caching. It will significantly change your Magento store performance.
For popular (heavily crawled by search engines) sites it is recommended to tweak robots.txt. This will save some resources.
Useful extensions for better Magento store performance:
Mostly all of your (template) images should be at least below 10kb. To achieve such a result you can crop the white space; use PNG8 or GIF instead of Jpegs; scale images; use image compression and CSS Sprites.
And don’t forget to specify Image dimensions.
You can also remove unused code and minimize the use of Javascript.
It is also recommended to work with lightweight template to create your own template.
Remember, that you can block cache and HTML output for extensions and apply Javascript Lazy Loader for prototype.
Magento configuration
Uninstall all unnecessary extensions.
And disable useless modules. To do this go to System -> Configuration -> Advanced -> Advanced.
Go to System -> Cache Management and enable all Magento Caches.
Use Google Analytics or other offsite stats tracker instead of onsite one.
Go to System ->Configuration ->Advanced ->Developer -> “Javascript settings” / “CSS Settings” and merge Javascript and CSS files or use the appropriate extension.
There are several Magento performance extensions which can speed up your webstore
If you have very large catalogs on your site you can enable the Magento Flat Catalog, It will help you to gain some extra performance.
Remember! Layered navigation consumes a lot of resources, so use it wisely.
Go to System > Tools > Compilation and enable Magento’s Compilation feature.
It is strongly recommended to use “file system” for most installations if your site runs on one server. If it runs on multiple servers, you should choose “database”. So use the correct session storage.
For product overview page reduce the number of products.
Go to Catalog -> Attributes -> Manage Attributes -> Frontend Properties and set to “Yes” attribute frontend properties that you’re going to use. All other – to “No”.
Go to System -> Configuration -> Advanced -> Developer -> Log Settings and turn off the Magento log.
For Enterprise you can disable Enterprise_CatalogEvent (Admin -> System -> Configuration -> Catalog -> Catalog Events); turn off settings for “Enable Catalog Event Widget” and “Enable Catalog Events Functionality “; turn on Solr search and Full Page Caching.
For speed tests, analyses and monitoring use Magento Speed Test; websiteoptimization.com; Google Page Speed Firefox extension and Yahoo Yslow; Analytics; Mon.itor.us or Pingdom.
A) Work with the server environment
Find a dedicated server: get the whole server power; become flexible in terms of new versions for database, webserver, php; don’t work with customers which run “bad” scripts and slow down other shops (or you can use google to block the ip which affects search ranking); don’t use the same ip.
Split database and webserver because they have different requirements: fast hard disks and much memory for database serverA webserver needs; less memory and more CPU for webserver.
Work with Multi Server Environment – a separate Backend Server. Handle all admin users and run all cronjobs there.
Don’t forget about updates: use latest MySQL Version.
Optimize the MySQL configuration. It can improve the performance of your store up to 65%.
Configurations for innodb_buffer_pool_size parameter
Use the MySQLTuner, which is a Perl script. With the MySQLTuner you can quickly review a MySQL installation and make all necessary adjustments to increase the performance of Magento web-store.
Mount disk with noatime option. It will also help you to get more performance from the site.
Use memory-based filesystem for dynamic data
You can use these key parameter for your php.ini:
realpath_cache_size = 32k
realpath_cache_ttl = 7200
max_execution_time = 90
max_input_time = 90
memory_limit = 256M
default_socket_timeout = 90
pdo_mysql.cache_size = 2000
output_buffering = 4096
Use a byte code cache like APC, it will prevent file system from slowing down in case of rising amount of requests.
php.ini configuration
apc.enabled = 1
apc.optimization = 0
apc.shm_segments = 1
apc.shm_size = 768M
apc.ttl = 48000
apc.user_ttl = 48000
apc.num_files_hint = 8096
apc.user_entries_hint = 8096
apc.mmap_file_mask = /tmp/apc.XXXXXX
apc.enable_cli = 1
apc.cache_by_default = 1
apc.max_file_size = 10M
apc.include_once_override = 0
Swap Apache webservers with NGINX webservers.
Turn on Gzip Compression in NGINX configuration.
Set expiration header for static files and don’t forget to enable mod_expire.
Use just necessary Apache modules and Eliminating .htaccess directory structure scans.
Uninstall xdebug or zend debugger on production, because they can slow down the overall performance up to 10-15%.
B) Magento configuration
Remember, that for Single Server Environment you can use APC as a magento cache storage (app/etc/local.xml)
For Multi Server Environment – memcached
Store sessions in memory
Disable extensions that you don’t need in app/etc/modules/*.xml and uninstall all the unnecessary.
Turn on all caches: System -> Cache Management
Go to System -> Configuration -> Catalog -> Catalog -> Frontendand activate “Use Flat Catalog Category” and “Use Flat Catalog Product” options.
You can also reduce the number of http requests. For this, you should turn on “Merge JavaScript Files” and “Merge CSS Files” options in JavaScript Settings.
To gain extra performance from your e-commerce store you can use a Full Page Cache.
Remember, that ioncube encrypted extensions slow down your online store and it’s impossible to use debuggers like xdebug or zend to step into the code.
Go to System > Configuration > Advanced > System -> Log Cleaning and activate cron and log cleaning
C) Magento Templating/Frontend
Remove all the unnecessary blocks from layout xml. To remove poll from the right column you should:
Don’t forget that for loading images on demand you can use Lazy Image Loader.
Modules for caching and extra performance
Lesti::Fpc
Lesti::Fpc is very powerful and free solution. Being internal full page cache for Magento stores Lesti::Fpc needs no varnish, no external software and no works with events. It is an internal cache which replaces dynamic blocks before sending response to customer.
Main features
cms_page_index, cms_index_index, catalog_product_view and catalog_category_view can be cached by default with Lesti::Fpc. You can also add your own layout-handles in the configurations.
global_messages, messages, right.reports.product.viewed and global_notices are default dynamic blocks.
top.links, catalog.compare.sidebar, cart_sidebar, wishlist_sidebar and welcome (in Magento 1.8) are default Lazy blocks.
to refresh the lazy blocks you can use such actions as: catalog_product_compare_clear; catalog_product_compare_add; catalog_product_compare_remove; checkout_cart_delete; checkout_cart_add; checkout_cart_updatePost; wishlist_index_remove; wishlist_index_add; wishlist_index_configure, wishlist_index_update; wishlist_index_allcart; .
id, page_id, category, p, dir, limit, order, mode are default uri-params, which can be handled in Lesti::Fpc. It is also possible to add some other params in the configurations.
And limit_page, sort_direction, sort_order, display_mode are the session-parmas of the extension.
multicurrency, multistore, different Prices for different customergroups and mobilethemes are possible in Lesti::Fpc.
default lifetime for every cached page is 24 hours, but you can change it in app/etc/fpc.xml.
apc, redis, memcached and other cachebackend can be set in app/etc/fpc.xml and app/etc/local.xml. To work with redis you need Cm_Cache_Backend_Redis.
To work with cach go to System => Cache Management. To find configurations visit System => Configuration => Advanced => System => Lesti FPC.
Lesti_Fpc works with Magento CE 1.5, 1.6, 1.6.1, 1.6.2.0, 1.7, 1.8.
Fooman Speedster is another poцerful extension, which you can get for free. The core controls are implemented by advanced self testing framework. Perform all self tests and make all the adjustments and configuration to enable the extension. And don’t forget that self tests doesn’t include testing for existing JS, so you should do this separately before installation.
Key features
Fooman Speedster combines multiple Javascript files into a single one. The same works for CSS files. The combined Javascript and CSS files get far future expire headers. This helps to reduce page load time
For empty and primed caches, extenыion also reduces the total size of files to be loaded and the number of HTTP requests.
Fooman Speedster is fully automated
It doesn’t need gzip support on the server to compress files
Fooman Speedster can be used for multi store
The extension uses the Minify library by Steve Clay, which was released under a BSD license.
Another powerful tool for Magento compatible with 1.7+. Nitrogento is a toolbox for optimization, which can be configured and deployed from the back office. It helps to reduce page load time and leads to faster reindex. Nitrogento costs €299.00.
Key features
Nitrogento adds new blocks to Magento’s cache mechanism. It can also learn blocks you are using automaticly and allows custom blocks.
Nitrogento also supports Full Page Cache.
It adds Expire headers, Etags and Gzip compression to the backoffice.
There is the Reindexation booster in Nitrogento. It can make reindexation performances up to 20 times faster.
For more information visit the official site of Nitrogento.
Some other important extensions, modules and speed up solutions
Brim’s Full Page Cache – $149.00 – speeds up Magento store performance by reducing the load on servers and increasing page speed. Seconds of load turn into a fraction of time.
JS/CSS optimisation & minification – Free – optimize and minify your css and js files with this module, use different methods and libraries.
M-Turbo – E-Commerce Accelerator – Free – caching component for e-commerce store. It saves significant amount of server resources; provides faster response to shoppers; and improves overall performance of the site.
Warp Full Page Caching – $350.00 – suite of caching modules. Warp Full Page Caching minimizes server needs and improves site’s performance, supercharging slow Magento sites.
Zoom Full-Page Cache – Free – feature-rich full-page caching system with versatile controls and hole-punching.
Full Page Cache Pro – $199.00 – this extension increases Web server request rate and reduces site’s latency and database load.
Performance Booster – $109.00 – fully caches the pages; deflates the size of the Java Script code and lowers the server load.