Large Object Caching - LocalCache Performance

I have several large objects that need to be stored and retrieved from the cache. These objects are about 1 - 2 mb.

When starting with localCache enabled localCache loading takes no more than a few milliseconds, but without it, it takes about 3 seconds, sequentially.

I use the cache role in Azure (colocated).

Can anyone shed some light on why it would be much slower without turning on the local cache?

0
source share
1 answer

LocalCache is local to the process, that is, inside the memory of the application process. If LocalCache is enabled, the object retrieved from the cache will also be stored in LocalCache. Each subsequent request for this object will be served from this LocalCache (there is no need to retrieve from the process cache). However, it takes time to retrieve the object for the first time.

According to MSDN :

When the local cache is enabled, the cache client stores a reference to the object locally. This keeps the object active in memory of the client application. When an application requests an object, the cache client first checks to see if the object is in the local cache. If so, the object reference is immediately returned without accessing the server. If it does not exist, the object is retrieved from the server. The cache client then deserializes the object and stores the link to this newly extracted object to the local cache. The client application uses the same object.

At that time, when the local cache is disabled, each request for receipt is sent to the proxy cache, which leads to the extraction of the object from the external memory of the process each time.

-Sameer

+1
source

Source: https://habr.com/ru/post/1238992/


All Articles