What is caching and how does it work?
How much do you enjoy browsing web pages that load excruciatingly slowly? We bet you hate it when this happens! A web page has to be quickly accessible if you do not want to lose visitors due to slow loading times. The first thing you can do to make your website fast is to program it properly, but if you want it to be really fast, you should use caching. What is caching? We will be happy to explain it to you!
Connecting to a website
To fully understand what caching is, we first need to take a look at how a visitor connects to a website. When you visit a website using your computer, you connect to the computer on which the website is stored: the web server.
This web server contains all the files (text, photos, codes, etc.) that are necessary for a website to be properly displayed on your screen. When your browser requests it, the web server looks for all those pieces of information and puts them together like a jigsaw puzzle.
And a jigsaw puzzle of, say, 10,000 pieces can take a while – at least a second or more for a web server. But since nobody likes to be kept waiting, the cache is there to speed things up. That cache contains all the pieces of the jigsaw puzzle and ensures that you get to see it all at once.
Because a fast website is important for your business: 40% of Internet users leave a website that takes longer than three seconds to load.
Caching is a way of making a web page appear faster. That is the short way to explain it, but of course there is a whole process behind data caching techniques.
Caching at Combell
Have you already decided if you want to use caching on your website? Check out the different caching options available at Combell.
When you visit a website, your computer will temporarily save all the bits it needed to download from the website in its browser cache. That way, the next time you visit that website, you will not have to download those pieces from the web server again, and the website will thus load faster.
You have probably already heard of "temporary Internet files", the Windows folder that people are often anxious to empty for some reason 😉. That folder is the cache: the temporary storage location for files that you may need again in the future.
Data that are stored in a cache contain files such as images or code from a certain website. These files are automatically stored on your device (computer, tablet or smartphone) the very first time you visit a website. When you visit that same page again, your browser can simply retrieve the files from the cache on your device.
The browser cache is a standard storage location on the 'visitor side' of the Internet: the data are cached locally on the visitor's device. But if you, as a website builder, want to have a really fast website, you can choose to add a server cache or HTTP accelerator between your website and your visitor. Such an accelerator can be installed either on the web server of your website, or on an external server provided by your hosting provider.
'HTTP accelerator' is a fancy word to describe a component that speeds up the interaction between a visitor and a website.
As explained above, when a web page is opened, a web server has to find all the pieces of that page and assemble them. This process can take some time. That is why an HTTP accelerator provides, among other things, website 'snapshots': snapshots that are displayed to visitors and that have already been put together.
With caching, certain parts of your site (which are the same for all visitors anyway) are stored in the caching layer the first time they are requested. This way, your web server does not have to compute that part every time. This helps save a lot of time and improves performance.
When you, as a visitor, visit a website that uses caching technology, you will thus be presented with a snapshot of that website. But how long has it been since that snapshot was taken? Well, that depends on the Time to Live (TTL) set by the website owner. The TTL is a duration that specifies when new information is displayed instead of the information contained in the cache.
At Combell, we also use a caching system: Varnish Cache. And, without exaggerating, our website is at least 30% faster with Varnish Cache than without it. And you too can use this technology!
Varnish is one of the most popular (and best) caching technologies, because it can cache whole pages – unlike other technologies that only cache parts of pages.
When someone visits a website with Varnish, he or she is first sent to the Varnish server. This server then checks whether the requested information is available in the cache. If it is, the visitor will immediately see the requested web page. If the requested information has not (yet) been stored in the cache, the visitor will be redirected to the web server, which will start downloading the data and assemble the web page.
Websites that use Varnish Cache load 300 to 1000 times faster than pages that do not use any caching technology.
Caching whole websites, however, is not the best way to go. Just think of a web store: product pages will remain the same for a long time, but shopping carts differ from user to user. Varnish Cache is also well aware of this, which is why it handles the information flexibly and only caches the necessary data.
The performance delivered by Varnish is impressive: websites with Varnish Cache load 300 to 1000 times faster than pages without any caching technology.
Want to get started with Varnish? Download our e-book!
Of course, there are other caching technologies besides Varnish: for instance, Combell also offers Redis. Redis works a little differently than Varnish: it does not store whole web pages, but makes the data of that page quickly accessible by storing it in RAM. RAM stands for Random Access Memory – memory that can be accessed quickly.
Redis is a great choice if you have a more complex website that involves more sophisticated techniques. With Redis, you have much more control over your cache than with the user-friendly cache that is Varnish, but it also requires a lot more technical knowledge.
Caching is included at Combell
Every Combell customer who purchased a shared hosting package can use the caching space with different technologies (Varnish, Redis, Ramdisk, APCu) for free.
Companies with a slightly more extensive package can of course have caching included in their package.
Why use a cache?
To increase the speed of your website
No matter how well you program your website, when the number of visitors is peaking, your website is at risk of slowing down. Because without caching, your web server has to make the same computations visitor after visitor. With caching, however, these computations are performed only once. This way, your web server does not get overloaded.
To rank higher on Google
Google will look at the speed of your website to rank it in its search results. In other words: the faster your website runs, the higher you will be ranked in search results… and the more visitors you will get!
To boost your sales
Nobody likes to shop on a website that takes ages to load. In fact, it makes us a little cranky. And cranky customers tend to make fewer purchases! So make sure your web store offers a great shopping experience by using the services of Varnish.
Wondering how you can make your own website faster? Ask our experts for advice – without obligation!