Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

networks

What is web caching?

Educative Answers Team

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

The web cache stores recently requested objects in its memory. When requests for these objects are placed again, the cache (not the original server) services these HTTP requests. If the requested object is not available in the cache, then the web cache contacts the original server to obtain the object. The purpose of caching is to reduce response time by avoiding calls to the actual webserver.

svg viewer

Steps

The following steps demonstrate how web caching works:

  1. The user’s browser makes an HTTP request for the desired object to the web cache.

  2. If the web cache does not have this object in its memory, it requests the original server for the file, sends the object to the user’s browser, and stores a copy of it along with the last-modified date of the object.

  3. When another user requests the same object, the object is available in the cache. Before sending the object to the requesting user, the cache needs to ensure that this object has not been modified on the original server.

  4. The web cache sends a conditional GET request to the original webserver, i.e., it tells the webserver to send the file only if it has been modified since the web cache’s last-modified date.

  5. If the object has not been modified at the original web server, then the response message will not contain the requested object, and the web cache will service the user’s request using the object in its memory.

RELATED TAGS

networks
Copyright ©2022 Educative, Inc. All rights reserved

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Keep Exploring