I have a few large objects which need to be stored and fetched from cache. These objects are around 1 - 2 mb in size.
When running with localCache enabled, retrieval takes no more than a few milliseconds, but without it, it takes around 3 seconds, consistently.
I am using Azure In-role cache (colocated).
Can anyone shed some light as to why it would be so much slower without localCache enabled?
LocalCache is local to the process, i.e. within the application's process memory. If LocalCache is enabled, object fetched from cache will also be stored in LocalCache. Every next request for that object will be served from that LocalCache (No need to fetch from out of process cache). However retrieving object for the first time will take time.
According to MSDN:
Whereas when local cache is disabled, every retrieval request is directed to out-proc cache, resulting in fetching object from outside process's memory every time.