Search code examples
cachingazureazure-web-roles

impact of setting azure localcache isenabled


Currently using Windows Azure Cache.

To enable local cache I set the following

<localCache isEnabled="true" sync="TimeoutBased" objectCount="100000" ttlValue="10" />

According to msdn - When local cache is enabled, the cache client stores a reference to the object locally. This keeps the object active in the memory of the client application.

My project runs on 2 web role instances. Does this mean that once I set this line it uses the Web Role's RAM as a local cache and when it does not find the object there goes to the Windows Azure cache? I do not want the web role's RAM being bogged down by this since I do not see a way to specify the size for localCache. Any suggestions would be greatly appreciated.

My complete cache configuration looks like this

<dataCacheClients>
<dataCacheClient name="default">
  <autoDiscover isEnabled="true" identifier="windowsAzure.mycacheurl.com" />
  <localCache isEnabled="true" sync="TimeoutBased" objectCount="100000" ttlValue="10" />
  <securityProperties mode="Message" sslEnabled="false">
    <messageSecurity authorizationInfo="xxxjdkj" />
  </securityProperties>
</dataCacheClient>


Solution

  • You are correct. If you have Local cache enabled the web role will use local RAM to keep a "copy" of the cached object. Another thing to note, that because it is a copy it could become stale and out of sync even from the main distributed cache.

    Right now the only reason to use local cache is for reduced latency and that would only happen if you had hundreds of transactions/second to make an important impact. You can test this performance yourself and you will see a negligible difference.

    I have deployed several large systems to Azure...two points:

    • the current Cache system of using a dedicated role is good enough. If you put it in the same Cloud Service, the latency is minimal and performance is very good. (it is MUCH better than the fist version of caching that Microsoft is deprecating)
    • if you want the fastest cache, there is a new distributed Cache in preview (as of 11/7/2013). It has a SUPER LOW latency: 1ms-1.2ms for read/writes...it is blazing fast and the local cache advantage is not existent. it is in preview mode, but all cache tiers should be viewed as volatile. Even though there is no SLA/could go down more often...your system could be architected around it.