Hacker News new | ask | show | jobs
by turtlebits 661 days ago
Before adding complexity, try to make your web sites smaller!

I'm not a big fan of adding more complexity (infra and money) to improve performance.

5 comments

Cloudflare and other cdn caches are a pretty standard web technology. Literally storing files closer to the client and serving it from hardware specializing in fast static serving
Yeah, there's no getting around physics when moving data over a long distance. Even in the absolute best case scenario if you ran a single uninterrupted fiber optic cable half way around the world it would still take about 100ms for light to cross it (fiber isn't quite as fast as the speed of light in a vacuum), and it's only downhill from there with realistic networking and protocol handshakes slowing things down.
You can't get around the laws of physics, but you can control the number of round trips necessary to render your website. With HTTP/3, you can deliver data to a client after just one RTT, and a 200-250 ms time-to-first-byte is still plenty fast for a CRUD app.
Both CDN and DNS should really be standard sort of practice. Simply because we cant beat speed of light.

The problem is modern day CDN do many clever things it is easy to go wrong.

Agreed, for example I have a ping of 200ms to Hacker News, and the last time I checked it still runs on a single core, and yet there was never a moment where I wished that Hacker News would be faster.

(Sometimes Hacker News gets fronted by Cloudflare when there is too much spam, but it's not the default)

Size isn't the only consideration though. Latency is pretty much a fixed cost for web resources, and caching is very beneficial if your edge cache is closer to the user than the origin server (and it is, unless you're very unlucky).
of course always better to make the code more efficient. But honestly it isnt very complex to have a CDN for static content