Are you sure you’re well verse with the term? Well, I can guarantee that you don’t.
‘Cache’ is often heard or may be an overheard term in the digital world. Though, we often get to read it along the dedicated server specifications, but only a few know what its role is.
Before describing its operation, it is important to know that Cache is often used in many protocols and technologies. The prime aim of Cache is to communicate between two or more machines faster. That means it avoids unnecessary recurrence action and data exchange. Take an example of the use and usefulness of the Cache in a web exchange to enhance overall performance more appropriately.
Note: The Cache is not something which is new to us; it can be rather used in a lot of other areas as well.
When a client makes an HTTP request to a website to access or retrieve a web page, the server doesn’t return the whole web page in one piece; the server sends a base code that contains of other links and packets in the best ordered form that the client will pick up when he finds them in the basic code (i.e. HTML). The HTML code just gives indication as “you have to go this place and search the image found on http://www.mydomain.com/images/image09” to display image or call CSS files that helps in shape and implement shape, color and HTML page.
What we learned from the above example?
When a client visits a website, the server plays a role of instructor saying that an element as an image or snapshot can be stored locally on the client side, because it’s a subject that is not changed often. If client revisits that page and using the same images, will therefore be able to go and get those pictures stored location in cached form and not on the server if it’s refreshed. Fetching a local file rather than a server file allows a faster response because it generates less action.
It is important to know that the example given above outlines what hides in the web browser, this is one way that can run the Cache, but there are many others. However, all repeat the same principle: store a query, file, object or an element defined in once place to make it faster provided to the use or final service. This is the main role of the Cache.
Client and Server Cache:
Overall, it can put forward two kinds of Cache: the Client Cache and the Server Cache.
As their name suggests, the first is the fact of hiding an object or a file on the Client side or near to the client side to start again the information in cached form. So the next time when client needs it, it’s found in search of the ARP Cache, DNS Cache, which will talk then.
The second category corresponds to the server side actions that are cached after queries. Often, the request made by client can be similar for each requests; the server will perform as a processing unit to provide an answer to queries (research, sorting, listing, calculations, etc…). The principle of the Cache server is that you will remember for a query and cache for the response.
Here, a first client makes a request to a server, could be a simplified application or may be a simple action (web, PHP page generation) or more complex (searching a large database, etc…). The server receives request, performs the necessary processing and calculation to answer and then responds to the client by caching the response. So that will help to prevent the repetition of same request, all calculation and research that is to do.
For example, to a query how much is 1+5? The answer is 6 for the first customer. If a second query or request is also same to the server, it will directly give answer 6 without trying to re-calculate (if the first response was cached). This makes it possible to respond more quickly to the server and also make it to use fewer resources that can then be used for other processes.
Here, a second client makes the same request to the same server. Our server have taken the precaution of putting this request and response as well in cached form and will not need to repeat the same process to respond. It will fetch the corresponding answer directly from its cache before returning to the client.
Stay tuned! In next part we will discuss and see some more examples of the Cache use!
Latest posts by Nilesh (see all)
- Why is Microsoft Turning Its Focus on Linux? - March 29, 2016
- Migrating Enterprise Data to the Cloud – A Checklist - November 30, 2015
- Why is your private cloud beginning to fail? - October 20, 2015