4

I'm no specialist, and even after scouring the web for answers, I couldn't really find a solution to my issue. The next is obviously hire a specialist, but I'd like to see if the excellent (avid reader here) StackExchange community can't offer some help first.

My Magento e-store is slow (http://preview.tinyurl.com/n7pccsf). And though there are pending optimizations to be carried out, the biggest issue by far is the time to first byte -- this hovers at anywhere between 1.6 seconds and 2.2 seconds; sometimes even more. That's especially annoying, and is most visible in the product page (smartphones).

I've failed to diagnose what's causing this -- I've even been touch with my hosting provider, and they've demonstrated to me that this is not an issue on their end. Again, I'm no expert, but any help will be appreciated, and I'll do my best to follow through (techie, but not a programmer here). They also told me that, since I'm on a Pro plan, but still a shared one, Varnish cannot be installed. They've installed APC for me though, and there's built-in support for Memcached (set to 64M) for Pro members.

Thanks in advance folks!

EDIT: I've just added an FPC extension (http://www.magentocommerce.com/magento-connect/lesti-fpc.html) -- that seemed to lower load times dramatically. But from what I understand, this solution mostly sweeps the problem under the rug than fixing an actual issue. Am I right?

  • While that makes a lot of sense, and I do have every intention (and already have) to look into that general avenue down the line, I've got to prioritize and worry about the here and now. In other words, while fancy hosting will obviously help speed up the site, there's virtually no load on it right now (and thus, zero orders and profit). Right now, I'm trying to do the best with what's available, and great hosting is a bit out of reach when a single transaction is yet to go through the site. Said otherwise, there are more pressing (and achievable) optimization issues at hand. – Chris Sep 29 '14 at 16:23
  • Or are you saying that these are irrelevant in the great scheme of things, and dishing out hundreds of bucks when we're yet to get things started is a better bet? Perhaps our scale is precluding me from thinking big, but down in the trenches you've gotta keep costs in mind or you're dead before long. – Chris Sep 29 '14 at 16:28
  • what is your magento version? – Konstantin Gerasimov Feb 21 '17 at 12:13
4

There are only 3 areas you need to look at when optimising the performance of your store - hosting, time for the first request to complete, and the number of requests per page. You may be interested to read our blog post, and also use our performance profiler, but to summarise:

Hosting - this is of course the foundation of your entire site and performance can only be as good as the hardware your site is running on allows. You do need to have acceptable page load times on uncached pages, and this is purely so that you maintain performance on pages which should not be cached such as the cart and checkout.

If the site suddenly becomes very slow when you go to checkout, you are likely to lose customers, so the right hosting properly configured is a must as a starting point (who you host with doesn't matter). Important rules though - always steer clear of shared hosting when it comes to Magento, and host on a server geographically close to you and your main target audience.

Time for first request to complete - by this I mean the time it takes for the server to generate the HTML in response to each request, excluding the time it takes for your request to reach the server, or the response to reach the browser after being sent by the server as these are connection dependant. This request is extremely important as only when this has completed will the user start to see anything render in their browser at all. It's this time which all FPC solutions (Varnish included) improve on so the user will see content start to render in their browser more quickly.

Number of request per page - while the above affects when the page will begin to render, the number of requests on the page affects how long it is before the page has loaded entirely with all assets - so images, JS and CSS. FPC will have no affect at all on this.

Every image, JS and CSS file which loads on your page is gathered via it's own request to the server. Every request takes a finite time to complete so you can therefore logically see that the more assets you use, the longer it takes for the page finish loading. Additionally the more requests you have the more requests queue and are idle as only a few requests can be sent at any one time - the makes page load times even longer.

Reducing the number of JS and CSS assets is straightforward - just turn on merging, but reducing the number of image assets is harder and requires you to review your page design and basically determine where images can be removed. You can also often reduce the number of images by combining smaller images into a very few single image 'sprites' or by leveraging more capable CSS3 styles to achieve things like rounded edges and button graphics which would historically have been done using images.

Around 60 requests per page will give decent performance, but 30 is a good target to aim for.

In your specific case...

Your hosting looks fine - I am seeing max HTML generation times of around 1.3 seconds for non cached pages, most of time around the 400-500ms mark. So on the first 2 points above you are looking ok.

The number of requests per page - this is where your main issue lies. I am seeing around 120 to 150 requests per page and this is very high. The first thing you should do is turn on JS merging which will reduce the number of request by around 50-70 (depending on the page).

You also however have good scope for creating sprites to reduce the number of image assets. There are around 75 images loading on the homepage alone, but many of them are small icons and buttons which can be combined into one (or very few) sprites. You have the potential to reduce the number of requests per page by an additional 40-60 here.

By enabling JS merging and creating sprites there is a very realistic chance of coming pretty close to the 30 request target for many pages, you will see a very marked improvement in complete page load times by doing this.

FPC

A word on FPC. It's not that it sweeps the problem under the rug, it's just thats it's clearly not sensible to have good performance on cached pages and poor performance during checkout. If however you do have acceptable uncached page performance then a FPC cache solution is a good choice to further boost the performance of your store. It is however important to test any FPC solution you implement to ensure the cache is being properly updated when it needs to be, for instance when a product goes out of stock. Many solutions are incomplete when it comes to regenerating cache content when needed. Also Lesti_Fpc is a popular free choice and performs reasonably well, but you will see better performance with some (but not all) of the paid solutions that are available (significantly better with ours).

  • I've turned on merging for both JS and CSS resources through the built-in functionality in the Admin, so that's a no-go. I've also manually minified a number of those, as suggested by Google, but am apprehensive about using an extension, as many complain that it messed up their site. I suppose I could backup before trying one and see if it works. As for "sprites", I'll have to read up on it and see if it is within my powers to implement. I'm a techie, so not afraid of messing up with code, so long as I get a hold of a proper guide, which is tough (at least one that feels tailored close enough) – Chris Sep 26 '14 at 16:45
  • Pages aren't currently being served with merged JS but CSS is (just look at the page source). There are however still a number of CSS files being served from the sm_sport theme unmerged so you might want to look at that - they aren't inside '<head>' as they probably should be. Don't worry about minifying your CSS/JS too much, you'll see much greater benefits from just merging, minifying will just reduce file size a little. Creating sprites is nothing more than just combining multiple small images into one and using CSS to show only the relevant part of the image for each icon/button etc. – Jonathan Hussey Sep 26 '14 at 17:00
  • I found why that may be -- the English scope wasn't using the default config, but it only missed JS and not CSS, as per your recommendation. I'm currently trying to implement those sprites with spriteme.com, but so far I only managed to hide the cart icon on the top right. The CSS sheet doesn't exactly mimic what's suggested by spriteme unfortunately, so I guess I've added background-position wrong. – Chris Sep 26 '14 at 17:12
0

3rd party extension is messing you up.

I just did a site audit with a problem like yours and it turns out Wyomind GoogleTrustedStores extension was the reason for extra 300ms on every page request.

Do the following:

  1. Download and install a fresh magento on the same server. The same version. No 3rd party extensions. Get it here https://magento.com/tech-resources/download. You can ask your host to set it up for you. You can install sample data but that is not required. You will use this fresh install to benchmark against your shop. Create a simple product if you are not using sample data. We need some data.

  2. Install profiler https://github.com/AOEpeople/Aoe_Profiler on both fresh install and your shop. Just google how to do that it is pretty simple to do for no programmer like you.

  3. Visit simple product page in fresh install and visit simple product page on your shop. Then go to Systems > Aoe Profiler and compare traces.

  4. While checking traces click on expand all and compare traces Fresh install vs You shop line by line. Look for red areas.

  5. Once you identify what is different between your shop and fresh install and what is taking most time you have two options: disable it or contact vendor you bought the extension from or had a theme developed and tell them about the problem.

Disclaimer: I understand a fresh install and your shop have different themes and a theme files might be a reason for slow down.

One thing to remember: Magento core files have very small room for speed optimization while 3rd party extension/theme code files are sometimes written without speed in mind.

-1

Review your .htaccess file. Enable modules/lib in php.ini or httpd config file instead of adding them in .htaccess file.

  • "httpd will look in every directory for .htaccess files. Thus, permitting .htaccess files causes a performance hit, whether or not you actually even use them! Also, the .htaccess file is loaded every time a document is requested.

  • "In the case of RewriteRule directives, in .htaccess context these regular expressions must be re-compiled with every request to the directory, whereas in main server configuration context they are compiled once and cached. Additionally, the rules themselves are more complicated, as one must work around the restrictions that come with per-directory context and mod_rewrite."

  • how exactly this helps with TTFB???? – MagenX Mar 4 '17 at 11:09

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.