Slowness with TTFB with custom domains

Hello,
I’ve migrated my blog to Netlify with a custom domain and I’ve found some weird behaviors.

I’ve a really slow time to first byte when using cURL with the custom domain. It’s working well with the domain *.netlify.com. I’ve hardcoded the IP (with the /etc/hosts file) to use the same server for both requests (167.99.137.12).

With the Netlify domain (aerialls.netlify.com with request ID b44bd1e7-9aa5-4653-8bda-a34ddf2d06fc-3994746)

      time_connect:  0.016061
   time_appconnect:  0.036165
  time_pretransfer:  0.036583
     time_redirect:  0.000000
time_starttransfer:  0.047494
                     --------
        time_total:  0.047690

All good. But with my custom domain (www.aerialls.io with request ID b44bd1e7-9aa5-4653-8bda-a34ddf2d06fc-4043648)

      time_connect:  0.017006
   time_appconnect:  0.041514
  time_pretransfer:  0.043533
     time_redirect:  0.000000
time_starttransfer:  6.255878
                     --------
        time_total:  6.256035

If I’m accepting GZIP encoding (Accept-Encoding: deflate, gzip), the TTFB is much better with both domains but I still can see a x5 factor between the two times (0.310832 for my domain vs 0.055943 for netlify).

The server is the same for both requests. I can’t explain why the TTFB is so much higher in this situation. I’m doing a simple cURL request without any extra parameter.

Thanks!

2 Likes

Heya @aerialls and welcome to our community! Sorry our welcome mat was not out and we took so long to respond!

The 6 second TTFB for uncompressed requests is something that is not unique to your site and our platform team is working on a fix for it right now after a long string of debugging to figure out what you figured out - it’s (some) uncompressed requests. Fortunately, no real browsers connect without compression - just monitors and curl, so I don’t think your organic/human traffic is suffering.

The 301ms ttfb though is something we consider normal (better performance is likely, if your content is in cache already; the cache however is contested by tens of millions of sites, and is per-cdn-node, so it is quite frequently the case that sites not under constant traffic from all locations are not always in cache).

But - if you’re seeing over a second TTFB reliably, we’ll be happy to take a bit closer look, since that is not normal.