Caching at Different Layers

Learn how cache works on different layers of web applications.

Introduction

When designing the API, we tend to focus on optimizing it with respect to performance. Let’s assume that multiple users want to access a Twitter trend and want to see the Tweets related to it. In response to these multiple network calls, the server retrieves the Tweets related to the trend from different databases and delivers them to each client. Next time, the client will experience the same delay for each request, including those made multiple times. The delay occurs due to HTTP's stateless nature, network calls, server computations, and so on.

This is illustrated in the slides below:

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.