O'Reilly's Performance Optimizations in a Cloud-Centric World

Learn all you need to know about email best practices, deliverability, and tools with email whitepapers and ebooks.

Issue link: https://hub.dyn.com/i/545501

Contents of this Issue


Page 29 of 38

Likewise, if your IPM data indicates that your cloud provider is routing traffic from certain locations via inefficient routes, you can elect to use a different provider in that region. Cache Content as Close to the User as Possible It's an old statement, but it's still as true as ever: the fastest request is the one you don't make, so it is best to cache content as close to the user as possible. Make sure all your static resources have appropriate expires headers on them so the browser will cache as you expect. If you're using any client-side data retrieval from APIs, then try to store what you can locally—JavaScript has access to local storage on the client now, so data can be stored across sessions. Future W3C standards such as service workers are designed to give more control to developers about what is cached on the client beyond the standard browser cache. Service Workers Service workers are a technology that allows you to install a Java‐ Script module that is executed as part of any future requests to your domain. What this means in practice is that you can intercept that request and intelligently decide how to handle it, including return‐ ing content direct from your JavaScript module rather than passing the request onto the server. Service workers are a published W3C standard but are currently only supported in Chrome. CDNs If you can't cache on the client, then try to cache as close as possible. This leads us on to CDNs, which we discussed previously in "CDNs" on page 9. CDNs are designed as globally distributed caching and delivery sys‐ tems. Modern CDNs offer much wider functionality than this, but this is the core of their function. 20 | Chapter 3: Minimizing Performance Risks

Articles in this issue

view archives of eBooks - O'Reilly's Performance Optimizations in a Cloud-Centric World