I serve a wordpress blog with nginx http cached to over 99% of the requests with a cache lifetime of 2 days. Here’s a webpage from the site. The webpages have quite a few images and therefore lazy loaded. The average size of the page is just one 1 mb.
The median response size is 10 KB
With speedcurve my TTFB is at a median of 0.6 seconds
Why is it this high?
I am behind cloudflare and all static assets like JS, CSS and images are versioned and cached from cloudflare.
My nginx config has
sendfile on; # https://forum.nginx.org/read.php?2,280434,280434#msg-280434 tcp_nopush on; tcp_nodelay on; #https://support.cloudflare.com/hc/en-us/articles/212794707-General-Best-Practices-for-Load-Balancing-at-your-origin-with-Cloudflare #https://www.nginx.com/blog/tuning-nginx/ keepalive_timeout 300s; keepalive_requests 10000;
I also have
initcwnd set to 10, initrwnd 10 and ipv4.tcp_slow_start_after_idle=0
The static website is also load balanced across two machines. One in Fremont and one in Mumbai with Cloudflare doing geographic routing.
Why is it that my TTFB this long and what can I do to reduce it?