Magento – Optimize your webshop

extreme-speed-banner

Recently, i have many works that focus on Magento optimzation, that explains why i have many optimization related articles stay close to each other :D.

Today i’ll introduce you another techniques belong to Magento itself, it means you can do it with only source code and admin dashboard. there’re two sections, first one is about configuration, and second one is about frontend. i hope you will enjoy it.

Optimize Magento using configuration

1. Single Server Environment:
Use APC as magento cache storage (app/etc/local.xml)

<global>
...
<cache>
<backend>apc</backend>
<prefix>mgt_</prefix>
</cache>
...
</global>

2.Multi Server Environment
Use memcached as central cache storage

<global>
...
<cache>
<backend>memcached</backend><!-- apc / memcached / empty=file -->
<memcached><!-- memcached cache backend related config -->
<servers><!-- any number of server nodes can be included -->
<server>
<host><![CDATA[127.0.0.1]]</host>
<port><![CDATA[11211]]</port>
<persistent><![CDATA[1]]</persistent>
</server>
</servers>
<compression><![CDATA[0]]</compression>
<cache_dir><![CDATA[]]</cache_dir>
<hashed_directory_level><![CDATA[]]</hashed_directory_level>
<hashed_directory_umask><![CDATA[]]</hashed_directory_umask>
<file_name_prefix><![CDATA[]]</file_name_prefix>
</memcached>
</cache>
...
</global>

3. Store sessions in memory
Single Server Environment:

Setup Memory-based filesystem for dynamic data (see point 8 above) or use memcached like multi server environment

Multi Server Environment

<global>
...
<session_save><![CDATA[memcache]]</session_save>
<session_save_path><![CDATA[tcp://127.0.0.1:11211?persistent=0&weight=1&timeout=1&retry_interval=15]]</session_save_path>
<session_cache_limiter><![CDATA[]]</session_cache_limiter>
...
</global>

4. Uninstall any extensions that you don’t actually use.

Disable not needed extensions in app/etc/modules/*.xml or delete

5. Enable all Magento Caches: System -> Cache Management.
6. Enable “Use Flat Catalog Category” and “Use Flat Catalog Product” to decrease database queries: System -> Configuration -> Catalog -> Catalog -> Frontend
7. Enable “Merge JavaScript Files” and “Merge CSS Files” to reduce the number of http requests
8. Use a Full Page Cache
9. Don’t use layered navigationif you don’t really need it, it needs a lot of resources
10. Limit the number of products on a product overview page.
System -> Configuration -> Catalog -> Catalog -> Frontend
11. Disable the Magento log
System -> Configuration -> Advanced -> Developer -> Log Settings (default is disabled)
12. Enable cron and log cleaning: System > Configuration > Advanced > System -> Log Cleaning


Optimize magento Templating/Frontend

1. Compress images
We often think that the higher the image quality is, the better our blog/site will look. Unfortunately, you are sacrificing a much more important feat – site’s performance! Higher image quality means higher file size. Higher file size means it will take longer and slower to upload/serve that file to a visitor.
Recommended services for image compression

* http://www.smush.it/
* http://www.jpegmini.com/

2. Minimize Javascript use
3. Specify Image dimensions.
4. Use Block cache and HTML output in your extensions.
5. Remove all blocks which you actually don’t use/need from layout xml
Example how to remove the poll from the right column

<layout version="0.1.0">

<default>

<reference name="right">

<remove name="right.poll"/>

</reference>

</default>

</layout>

6. Use a Lazy Image Loader to load images on demand
7. Use a lighweight template