I have a website built on magento 1.9.3.x , when I test my website on tools.pingdom , it gave me a TTFB of over 10 sec.

How can we optimize this time to speed up the performance of the site.

Thank you.

  • Install New Relic and see what the bottlenecks in PHP are. It's possible that you've got entity loads within for loops when you should be using collections etc. – Luke Rodgers Apr 27 '17 at 12:38
  • use Aoe_Profiler it will show you everything – MagenX May 2 '17 at 7:15

This is a big subject and talking about it would never end. You should look into your server configuration Ram and SSD hard drive will make big deference.

Few things I would suggest to do:

1- Compress and merge all js and css, don't use magento for this you can look at https://github.com/GordonLesti/Lesti_Merge

Download the app folder into your site app folder and the option will show on backend System > configuration > developer

2- Optimise images using jpgoptim and optipng

Please remember to backup your images before you start.

On command line navigate to /media/ or /images/ in skin folder

JPG: find . -iregex ".*.jpe?g" -exec jpegoptim --max=80 --strip-all --all-progressive {} \;

if not installed please run yum install jpegoptim

PNG: find . -iname '*.png' -exec optipng -o7 -preserve {} \;

you can also add the above command lines to cron and run it every few weeks or days

3- Disable and remove unused module, don't disable modules via magento backend do this via xml file

locate the module xml in app/code/etc and change true to false. And if you not using Magento RSS or Poll you can disable it from the backed.

4- Use lazy load on images and load more on category pages.

I use http://dinbror.dk/blog/blazy/ for the past 10 month, works fine and easy to integrate.

For category there is lots of infinite scrolling module free and paid, personally I only use https://www.manadev.com/infinite-scrolling

5- Enable zlip compression and enable browser cache in your htaccess

use mode deflate

<IfModule mod_deflate.c>

    AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript
    AddOutputFilterByType DEFLATE application/xml application/xhtml+xml application/rss+xml
    AddOutputFilterByType DEFLATE application/javascript application/x-javascript
    #AddOutputFilterByType DEFLATE application/x-httpd-php

    BrowserMatch ^Mozilla/4 gzip-only-text/html
    BrowserMatch ^Mozilla/4\.0[678] no-gzip
    BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html

    SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
    SetEnvIfNoCase Request_URI \.(?:exe|t?gz|zip|bz2|sit|rar)$ no-gzip dont-vary
    SetEnvIfNoCase Request_URI \.(?:pdf|doc)$ no-gzip dont-vary
    SetEnvIfNoCase Request_URI \.(?:avi|mov|mp3|mp4|rm)$ no-gzip dont-vary


and extend expires

<IfModule mod_expires.c>

# Enable expirations
ExpiresActive On 
ExpiresDefault "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 year"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/javascript "access plus 1 year"


Don't forget php_value memory_limit should be at least 512M

6- Use page cache module

Again there is lots of module will cache your pages just look on magento connect or market places - I don't use it a lot but when I do I use https://github.com/GordonLesti/Lesti_Fpc

7- Enable and use Redies

Here is a good post will show you how to install and use with Magento http://inchoo.net/magento/using-redis-cache-backend-and-session-storage-in-magento/

At the end I strongly suggest that you look into your hosting hardware, make sure it is capable to run Magento and again as @MagenX suggested you can use magento profiler.

Hope this help

  • you just copy pasted all these here, but this is not the answer, you just have to install profiler and find the problem... – MagenX May 2 '17 at 7:15
  • Went over to GitHub to Lesti_Merge and did not really understand how/where to add the code to the site. Could you please update your post and explain (in details if possible)? Since we are new to Magento it would be great help and really appreciated. – marikamitsos May 16 '17 at 12:06
  • Download app folder from GitHub and uploaded it to your site app folder – Ahmed Elawadi May 16 '17 at 20:11
  • Only points 3, 5, 6 and 7 of this effects TTFB, the rest effect overall page load time – eddhall Feb 21 '19 at 14:40
  • @AhmedElawadi I didn't downvote? It's still less than 60% relevant – eddhall Feb 26 '19 at 21:52

I would use google insights if your site is connected to the web. Just plug in your url and it will give lots of detailed information about how to speed up your site. https://developers.google.com/speed/pagespeed/insights/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.