What is output caching in web application ?

1 votes
150 views
Mishra Ji asked 11-Jan-2019 in Application by Mishra Ji

Output caching has big benefits in applications that need to perform complex queries or calculations before displaying data, or that spend a significant part of their time rendering (turning the data into HTML). 

1 Answer

0 votes
Sanat Shukla answered 28-Jan-2019 by Sanat Shukla
Output cache is a mechanism that keeps a copy of a rendered ASP.NET web page in memory. These behavior helps to improve performance by returning a response of the cached web page instantly and by reducing the need to render the page in every client request. Supposing a page takes a lot of time to render using output cache can significantly improve the performance. But, the output cache has a very big drawback. When your site needs to enable customization for users or needs to show dynamic information you don’t want your users to have the same version of the page.
In-Process of Output Cache:
Advantage:
Speed Performance, while it is in the memory of the application; the speed is like read and write a variable. We can put any objects without serializing it in the memory (in out-of-process you have to) Perfect for a single application or a web application that runs just on one server.
Disadvantages:
In case, you have more than one server running your web application you cannot share cache between those two servers. Then you are limited to the memory of your server and filling up the memory of the server is dangerous because it can affect the whole system. The Cache will be deleted whenever your application is restarted because the cache like all your variables is in the memory of your app. So when you remove all cache, consider if you have a deployment strategy.
Out-of-process caching
Advantage:
Cache MEMORY is not shared with the memory of your server or servers. We are not limited to the memory of the serve. We will have a single place or cluster to read and write objects from and into the cache. Therefore you have shared cache between your servers. Cache memory is not deleted when our application is restarting.
Disadvantages:
This is slower than in-process caching.
You have to serialize the object first and then put it in the cache. Because the cache is on the network and your object has to be transferred over the network for reading and writing into the cache. And anything which is going to be transferred over the network has to be serialized and deserialized. (If you can find a way to transfer an object as it in the memory over the network you can start a new revolution in the digital world)
You are limited to the memory of your server and filling up the memory of the server is dangerous because it can affect the whole system.