Asynchronous request batching and caching
In high-load applications, caching is essential. It powers much of the modern web, helping to serve everything from static assets such as web pages, images, and stylesheets to dynamic data such as database query results. In this section, we will dive into how caching strategies apply to asynchronous operations and how, with the right techniques, a surge in requests can become an opportunity rather than a problem. We will explore powerful patterns such as asynchronous request batching, which can help you optimize performance and resource usage even further.
What’s asynchronous request batching?
When dealing with asynchronous operations, the most basic level of caching can be achieved by batching together a set of invocations to the same API. The idea is very simple: if we invoke an asynchronous function while there is still another one pending, we can piggyback on the already running operation instead of creating a brand-new...