3

I have a website hosted on EC2 with most css, JS and images loaded from Cloudfront. There is a consistent problem that even small css and js files have 1-2 seconds time to first byte, even where there is a cache hit on Cloudfront. Here is a screenshot from websitepulse:

enter image description here

None of these css files are particularly large. I have also run this test twice straight after each other, but there seems to be no difference.

Is there any limit I may be hitting on Cloudfront? Or any sort of interdependence of requests because of HTTP2?

  • Can you run the same test with webpagetest.org from a couple of nodes and see if the results are the same? – Tim Sep 3 '17 at 9:03
  • This particular set of assets is similarly slow from further away, always around the 1.8-2s mark. I have tested 3 other locations. But of additional concern is that this is hosted in Sydney with the audience fully in Australia. – jdog Sep 3 '17 at 9:13
  • Have you tried fetching that asset directly, or are you only requesting it through that page? Might be a good idea to just focus on one asset, and debug that. – Reverend Tim Sep 7 '17 at 11:27
  • Without a lot more detail on the page and requests, its impossible to say what's really going on here, but you seem to be labouring under several false impressions about the nature of web performance. If you want your page to go faster then you need to start merging those files - http2 can only do so much. Try using mod_pagespeed. – symcbean Sep 9 '17 at 23:28
  • @symcbean, well can you put the reasons why I need to merge files into a canonical answer. I don't see why I can't get the benefit from just using HTTP2 for getting the same effect of merging. Assuming there is no limit of parallel connections from the same referrer on cloudfront. – jdog Sep 10 '17 at 3:58
1

I was having TTFB as 1.5s. After few hours of digging, I realised that the reason was in my ... DNS.

I was using some family safe DNS which was causing the lag. Switching back to Google's 8.8.8.8 did the trick.

  • But even with http2 that's a ridiculous number of CSS files – symcbean Jan 24 '18 at 23:52

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.