"Slow and steady wins the race" they say.
They are wrong.
When it comes to website load times, every millisecond counts. For every 1000ms of additional latency, visitor satisfaction drops by 16%.
Every time I visited my selfhosted services (including this blog), I noticed that it would take ages to load on the first visit, but things were quite speedy after that. For a while, I chalked it up to some odd configuration on my personal device, but just yesterday I noticed it on my desktop PC as well. This PC is connected over Ethernet to my collage's network, which has excellent performance (most of the time), and no special configurations or weird brower settings.
I wondered what the hold-up was. Maybe some JS library is getting cached that takes a while to load. Perhaps a large font is being loaded in a blocking manner.
I tossed my blog into Pingdom Speed Test, which told me that it wasn't just me getting these long load times.
So... what exactly is the holdup?
Images? Fonts? Libraries? Something else?
The problem, as usual with this sort of thing, was DNS.
Yikes.
My DNS provider is Cloudflare, but something tells me that Cloudflare isn't the holdup.
Yes, I use a DDNS provider. I cannot be arsed to set up a script to auto-update the Cloudflare DNS settings.
Just to make sure that my DDNS provider was, in fact, the issue, I threw their homepage into Pingdom to double-check.
Yep. DuckDNS is the issue. Hosted on AWS my ass. That has got to be the slowest AWS server I have ever seen. What are they hosting it on, S3 Glacier Deep Archive??
I do feel bad holding a completely free service to such a high standard, but still, a >1s DNS response is pretty bad.
Anyway, I realized that my "dynamic" residential IP hasn't changed in over a year, and that's close enough to static for me to just set it normally in the Cloudflare dashboard. I'll update it myself next time my IP updates.
The results speak for themselves.
And the waterfall is even more dramatic...
That is a 98.51% reduction in DNS latency. Absurd. The whole website loads in under 0.3 seconds, not including fonts, which push it up to 0.42s. Overall, it's 5X faster than before. If you use DuckDNS, I would recommend either making a script to update the CF DNS configuration or just updating it yourself.