Nobody likes a slow response from a web server, and users will not wait. In fact, according to Portent conversion rates drop by drop by an average of 4.42% with each additional second of load time (between seconds 0-5). Web caching to the rescue! Let’s get a sneak into web caching and how it works.
Web Caching — An Overview
Web caching comprises the process of storing the data of web pages in a proxy server in order to reduce the load of requests received by web servers.
Whenever a user visits a website, it takes some time for the browser to load the content of the website. Your browser sends the request to the hosting web server to respond with the website content. All the static content coming through this request is stored in the cache server first as a copy. Your browser won’t have to grab all the content from the hosting server the next time you visit the same website. All the static content is loaded from the caching server and the remaining content is provided by the hosting server.
This process brings a lot of benefits to the server end. The hosting server does not have to deal with overloaded requests from browsers. Moreover, it takes less bandwidth for the transmission of website content as all the static content is provided by the proxy server. The loading time of frequently used websites also decreases.
Autoscaling of cloud servers resolves the issue of server overloading, but the latency issue remains unresolved. This is where AWS CloudFront provides a holistic solution to cater to latency as well as server overloading issues.
There are edge locations that are allocated to specific regions. Each edge location or edge server contains a cache memory. Let’s take the example of a region with two users. If one of the users searches for the website, then the allocated edge location will send the request to the origin server to copy the website content and send the data back to the user. When the second user sends the query for the same website, DNS directs the request to the edge location. But this time, the response does not come from the origin server. The copy of website content saved in the edge location is sent back to the user as a response with no involvement of the origin server this time. This resolves the latency issue and makes the data transmission between the server and the user very fast.