4

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?

jdog
  • 111
  • 4
  • 28
  • Can you run the same test with webpagetest.org from a couple of nodes and see if the results are the same? – Tim Sep 03 '17 at 09: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 03 '17 at 09: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 07 '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 09 '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 03:58
  • I prefer not to merge files as I'm the hosting company and I can control the CDN, but merging will require too muchclient interaction – jdog Sep 10 '17 at 04:01

1 Answers1

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.