Hacker News new | ask | show | jobs
by handsclean 244 days ago
A performance problem I’ve run into with small websites like this one is many caching systems are tuned for bigger companies or hotter programs, and basically every load ends up an “exceptional” cold start case. VMs wake up, Cloudflare actually only keeps your data one place, there’s no sane HTTP caching value, and, yeah, files are read from disk. Worse, it’s easy to miss during testing by loading things more frequently. I’m sure there are filesystem or server parameters to tweak, but I do think small websites that want great performance should be, somewhere somehow, managing caching manually.
2 comments

Its not the the data is only cached by Cloudflare in one place, its that it is cached at the edge node nearest to the user that last made the request. Geographically different users will likely hit a completely different edge node that needs to hit your origin to populate its cache.

Cloudflare has a free tiered caching option that helped my site. Instead of cache missing on local edge nodes always having to hit the origin, the edge node can sometimes pull the data from another Cloudflare server. It reduced load on my origin.

Agree with needing to tune and validate caching, one of the biggest changes my PHP site was tuning apc/OPcache sizes.

Cloudflare will actually slow down TTFB for small, less popular sites since they don't maintain a keepalive connection to the origin. This means you pay an additional TCP/TLS setup cost from the Cloudflare POP to the origin which is worse than a direct connection. I also tried testing a smart-placed worker and cloudflared, neither of which seemed to help.
They can use keepalive but it's likely the small sites are not getting enough traffic on the edge nodes to maintain the connections.

You don't think taking a small hit on TTFB is a good trade off for the improved scaling that a CDN offers?

Gone are the days that you don't have to worry about bot traffic being a DDOS. An unresponsive site is a lot worse than an extra TCP/TLS setup.

> files are read from disk.

Disk as in spinning round circles, or disk as in NVMe drive, because there's a pretty massive difference in latency.