Back to Top


Phone: 952-255-8599


Email: tj@wpmarket.net

How does website caching work?

cachingMost people have heard about website caching, and yet few of them understand its inner works. In a nutshell, web caching means storing frequently accessed information in a file or memory area, with the goal of retrieving it as quickly as possible later on, when it will be needed again.


As you probably know, a website consists of a series of files which are stored on a specially crafted computer which is connected to the Internet 24/7/365 - a server. Whenever a person wants to access the desired website, his or her browser sends several requests to the server that stores the files for that particular site.


Before caching was invented, web hosting companies tried to make this experience as snappy as possible by investing a lot of money into lightning fast servers, which included super-fast CPUs, a lot of RAM memory, high-speed solid-state drives (SSDs), and so on. Fortunately, things have changed for the better with the invention of server-side caching. And modern browsers, which have implemented browser-side web caching, have taken the things to the next level.


Due to web caching, websites that needed 3-4 seconds to load in the past can now be fully loaded within 1 or 2 seconds. It may not mean that much, but several stats have demonstrated that mobile users are quite picky, so they tend to avoid sites that don't load in less than 2-3 secs. And since mobile users rule the web now, it is essential to have a site that pleases them all.


Just think about it for a second: a server which hosts a site that's accessed by tens of thousands of users at the same time must be powerful enough to process millions of client requests per second. Because whenever your browser needs to load a new image, a CSS file, a HTML file, and so on, it will request it from the server. So, if you own a site that's visited by many people, you will need to invest a lot of money into a very powerful server or pay a hefty monthly fee to a web hosting company.


The good news is that server-side caching helps reduce server loads by sending canned, pre-stored responses to common browser requests. Hosting providers who have implemented server-side caching will often use a proxy, a small-sized server that can intercept frequent requests from the clients, and then deliver the requested static files without overwhelming the main server, thus freeing its resources for "real" computing work.


People who have customers worldwide will benefit from other types of server-side caching solutions - content distribution networks (CDNs). Most CDNs consist of networks of proxy servers which reside in various geographical regions. This way, if several French citizens try to access CNN's US website, for example, they will use their browsers to send the first few requests to CNN's American server, but they will get the requested resources (web pages) from a proxy server that's located much closer to them, in France.


Browser-side caching works similarly, but the code that makes it tick will store the files locally, on the visitor's own computer. This improves people's website browsing experience by serving the requested resources much faster, in case that visitors return to a previously visited site. And when people use browser-side web caching, hosting companies are happy as well, because their servers don't have to handle so many requests.

BOOST THE LOADING SPEED OF YOUR WEB APPS

I CODE SERVER AND BROWSER-SIDE CACHING PROJECTS

CONTACT ME