Hacker News new | ask | show | jobs
by richmarr 3473 days ago
> ... something you should measure rather than just assume

How do people do this?

My obstacle with this point is each CDN would have a different impact in each locale due to the locations of their points of presence, and CDN-ing each resource would a different impact based on the sites that particuar individual had visited.

Measuring it in any useful way in advance of a change would be really hard unless I'm missing a trick, and measuring it in hindsight would require the kind of performance logging that PaaS-level apps don't have access to.

3 comments

This would be extremely useful data to have and when I last looked I found little to go on. For example, how great would it be to have an extra column on a page like this with cache hit rates? https://cdnjs.com/libraries

Nice to have these free hosted assets, but I suspect that a lot of these are an additional download and not actually cached by the majority of visitors. Just having a rough estimate would be helpful when choosing whether to directly serve an asset or use a CDN.

my recommendation is to first serve everything yourself over TLS (minified, bundled, gzipped). if you can, run HTTP2. then measure.

if this does not deliver the perf you expect (chances are that it will), then look into CDNs.

if you need to serve media that needs a lot of bandwidth (expensive) then look into CDNs.

if you need some form of real-time comm like WebSockets or WebRTC that actually requires low latency, look into distributed systems (amazon, google, azure, cloudflare?, etc..)

Sure, my question was how people measure.
your best bet is https://developer.mozilla.org/en-US/docs/Web/API/Performance

combined with either IP2location or Geolocation apis.

You can use JavaScript timers to measure how long things take to load and infer how many of the resources come from cache, etc.