Back in 1967, IBM System Journal’s editor Lyle R. Johnson got stuck in a situation that was common in the early days of modern computing. In front of him, there was an article explaining exciting memory improvement in Model 85, a high end IBM System/360 machine.
The improvement was due to local storage. Thus, Lyle wanted to use a term more descriptive than “high speed buffer”. Just before the publication of the paper, he suggested the term “cache” that has its roots in French word cacher which means “to hide”. The term got approval from the author and since then, it has found a significant place in the industry’s jargon.
Cache works on a simple principle: providing a temporary storage for operands and content to be accessed later. From your internet browser to a web server, it can be found everywhere. In this blog post, we will be covering different levels of caches and why it is beneficial for businesses to create a caching strategy beforehand.
Levels Of Web Cache And Their Functions:
While every kind of cache serves the same purpose, we can divide them based on where the storage takes place.
Level 1: Browser Cache:
Browser Cache or Personal Cache is available in all modern browsers (like Firefox, Chrome, IE). It works on the simple rules and stores a specific amount of web objects (HTML, CSS and JS) on your hard disk. For example if you hit the back button, your browser will display the page from cache instead of sending a request to web server again.
In a test performed on Yahoo.com by Yuiblog, it revealed that a site takes almost a second and half extra to load if the browser cache is empty. Similarly a full cache page view makes 90% less HTTP requests and 83% less downloads than an empty cache page view.
Level 2: Proxy Cache (Web Server Accelerator):
Proxy caches work on the same principle as that of browser cache, but they serve a large amount of users. This kind of cache sits between client and the web server. It watches as the requests for HTML pages, images and other static files (objects) come by and stores a copy of them. Apache, Nginx and Varnish are some common examples of caching proxy servers. They can also work as reserve proxy that is they can store the data given to them by server.
Web server accelerators, by storing data, lowers the load on origin servers. Secondly, they can serve content quicker and to more audience while consuming less resources. It is necessary to implement a good cache mechanism while keeping a strict check on it while you update your website. In a recent post, we compared the latest versions of Apache and Nginx to find out how over time they have enhanced their performance.
Other Applications of Caching Mechanism:
Caching is an integral part of web technology. This has resulted in many other types of caching that are build for specific purpose. A few of these purpose-built caches are explained along with their practical applications:
Content Delivery Network:
Content Delivery Network (CDN) is a group of servers located in different regions. They provide great benefit in terms of ensuring high availability and performance of rich media content all over the world. They cache static content in order to lower network latency for a user whose physical location is far away from the datacenter. If a user requires any of these files, he is served from the CDN closest to his location instead of making a request to the datacenter.
[You should also read: Why You Should Use A CDN For Website Optimization]
Present day applications are usually deployed on a multi-tier setup. This means front-end web server, middle application server and back-end database are separate. Three-tier architecture is very common where it is not feasible to put the database and the application on the same server.
This multi-tier setup, on the other hand, creates a network overhead as app and database are at different hosts. A light-weight database or, in other words, a database caching mechanism is required that can store frequently used indexes and data subsets.
Database caching not just helps in achieving high performance and scalability, but it also provides availability even if back-end server goes down. Memcached is a popular database caching system that is widely used in ecommerce sites and social media networks.
Opcode caches are PHP accelerators that help in enhancing the performance of applications built on PHP. It eliminates the repetitive compiling of the PHP code by caching the results of compilation phase.
By doing so, the source files are no longer required to be compiled again and this leads to faster runtime executions. It has been observed that a large source code base application (like a CMS software) can see up to 3 times faster page generation.
Which Opcode Cache to be used?
Over the past few years, Alternative PHP Cache or APC has been widely used for Opcode cache. Another Opcode cache named Zend, a once-proprietary solution which had more features than the APC, has established its base inside the industry.
With PHP 5.5, Zend was made open-source. It is now packaged with PHP by default. Though APC is still popular, it has several issues especially its reported incompatibility with the latest version of PHP.
Optimizing your website and applications for high performance is the need of the time. While caching plays an integral role in it, the need and mechanisms differ with app requirements and considerations. Get a free consultation session with our cloud experts to find the right solution for you.
Start Growing with Cloudways Today.
Our Clients Love us because we never compromise on these