Prototyping optimizations with Cloudflare Workers and WebPageTest
This article discusses how to use a combination of WebPageTest and Cloudflare Workers for quick testing of new performance ideas or evaluating the latest performance wisdom. The author explains that setting up another internet-facing server can be time-consuming, but using these two technologies allows for rapid iteration and review of different experiments. Cloudflare Workers is a lightweight JavaScript execution environment that enables developers to modify requests and responses without maintaining infrastructure. It provides an event-based fetch API similar to the Service Worker API in browsers. WebPageTest, on the other hand, can re-point arbitrary origins to a different domain using its overrideHost command. The author demonstrates how to set up a Cloudflare worker and configure WebPageTest to redirect requests through the worker. They also provide examples of basic workers that can modify HTML responses or change request priorities. The potential performance improvements from these techniques are illustrated with filmstrips and waterfalls, showing the effects of loading pages over a single connection and modifying HTTP/2 prioritization. In summary, combining WebPageTest and Cloudflare Workers offers an efficient solution for testing new performance ideas and understanding their impact on website performance.
Company
Cloudflare
Date published
Jan. 8, 2020
Author(s)
Andrew Galloni
Word count
1270
Hacker News points
None found.
Language
English