In 1967, Lyle R.Johnson a Journal’s editor at IBM Systems found himself stuck in a situation that was very common back in the early days of modern computing. With him was an article that explained a new memory improvement in one of IBM System/360’s high-end machine called Model 85.
This improvement had been made possible because of local storage. Rather than using the term “high-speed buffer”, Lyle thought of using a word that was more descriptive. He then suggested that the term “cache” meaning “to hide” be used. This term got an approval and ever since it has been used among the industry’s jargon.
Cache operates on a simple principle: It provides temporary storage for content and operands for later access. From a web server to an internet browser, you can find it everywhere. This article covers different cache levels and why it’s important for a business to develop a caching strategy.
Web Cache Levels and Their Functions:
Every cache type does the same job, but they can be divided based on where storage takes place.
Level 1: Browser Cache:
The Browser Cache also is known as a personal cache is present in the modern browsers such as Chrome, IE, and Firefox. Browser cache operates on simple rules to store a certain amount of web objects such as CSS, HTML, and JS on the hard disk. For instance, when you hit the back button, the browser displays a cached page as opposed to sending a new request again to the web server.
A test that was done on Yahoo.com, showed that if a browser cache is empty, a site takes close to a second and a half more to load. A full cache web page view does 83% fewer downloads and 90% less of HTTP requests than a cache page view that is empty.
Level 2: The Proxy Cache or Web Server Accelerator:
The proxy cache works the same as the browser cache does, but the difference is that the proxy caches serve a big number of users. The proxy cache is based between a client and a web server. It looks out for any requests for images, HTML pages and other static objects that come by and keeps a copy of each. Some popular proxy server examples are Varnish, Apache, and Nginx. These web servers can also operate as reverse proxy storing the data given by server.
By storing data, these web server accelerators lower the load on the origin servers. Also, they can distribute content faster and to more people while using fewer resources. It is necessary to set up a good cache mechanism and maintains a strict check on it as you update your website.
Caching Mechanism Other Applications:
Caching is an essential part of web technology. Thus, there are many other caching types that have been developed for specific purposes. Here are some purpose-built caches with their practical applications described.
Content Delivery Network:
This Content Delivery Network is a bunch of many servers located in various regions. They offer great use in ensuring high performance and availability of the content that has rich media from all over the globe. For users that are located far from a data centre, they provide they lower the network latency by caching static content. If a user requests any of this content, he gets it from the CDN that is nearest to his location rather than requesting the data centre.
Modern day applications are typically deployed on a setup that is multi-tier. This is to say the front-end web server, the middle application server, and the back-end database is separate. The three-tier architecture is very popular where there is no option of having the database and application on the same server.
On the other hand, the multi-tier setup develops a network overhead as the database and app are at different hosts. A database that is lightweight or in some other words, a caching mechanism database is needed which can store data subsets and indexes that are frequently used.
Apart from achieving scalability and high performance, database caching also provides support even when back-end server has gone down. On social media networks and eCommerce websites, there is a popular database caching system called Memcached.
Applications that are developed in PHP, use PHP accelerators called Opcode caches for enhancing their performance. They eliminate PHP code repetitive compiling by caching all the results of each compilation phase.
This ensures that there is no need to continue compiling the source files again which leads to runtime executions that are faster. It has been proven that an application like a CMS software which has a significant source code base can get page generation that is up to 3 times faster.
Opcode Cache to be Used
In the recent couple of years, APC or Alternative PHP Cache has been used widely for Opcode cache. Another Opcode cache called Zend that was once a proprietary solution with more features as compared to the APC has also established ground in the industry.
Zend was made an open-source with PHP 5.5. Zend now has PHP packed by default. APC is still very popular although it now has multiple issues more so with reported incompatibility with new versions of PHP.
Today, it is very important to optimize your applications and websites for higher performance. Caching plays a major role in this, but app requirements and considerations differ from need and mechanisms.