Chapter 10. Fine-tuning asset delivery

This chapter covers

  • Understanding compression basics, the impacts of poor compression configuration, and the new Brotli compression algorithm
  • Using caching to improve the performance of your website for repeat visitors
  • Exploring the benefits of CDN-hosted assets
  • Verifying the integrity of CDN resources by using Subresource Integrity

Until now, we’ve spent much of this book talking about techniques specific to the constituent parts of web pages, such as CSS, images, fonts, and JavaScript. Understanding how to fine-tune the delivery of these assets on your website can give it an added performance boost.

In this chapter, we’ll spend time investigating the effects of compression, both for good and ill, as well as a new compression algorithm named Brotli. We’ll also touch on the importance of caching assets, an optimal caching plan for your website, and how to invalidate stubborn caches when you update your content or release new code.

Moving away from web server configuration, we’ll learn how your website can benefit from using assets hosted on Content Delivery Networks (CDNs), which are geographically dispersed servers. You’ll also learn how to fall back to locally hosted assets in the unlikely event that a CDN fails, and how to verify the integrity of CDN assets using Subresource Integrity.

10.1. Compressing assets

10.2. Caching assets

10.3. Using CDN assets

10.4. Using resource hints

10.5. Summary