Wizz Droid on Wed, 30 Oct 2013 15:15:34
We have very simple Poc:
1. query a simple table from Azure database, e.g.: select * from TableA
2. query TableA and put it into cache (in role cache)
<autoDiscover isEnabled="true" identifier="Blablabla"/>
<localCache isEnabled="true" sync="TimeoutBased" objectCount="1000" ttlValue="300" />
The funny thing is, Azure SQL query takes 45ms, but by using In Role cache it took about 1s.
Have I missed something?! Or it's just that bad?!
Gaurav Mantri on Wed, 30 Oct 2013 16:36:50
1 second time you mentioned, is it for the 1st put? If that's the case, then it is expected as cache initialization is a time consuming process. Once the cache is initialized the puts and gets should be much faster.
Hope this helps.
Wizz Droid on Thu, 31 Oct 2013 09:28:27
There's an article in the MSDN (http://www.windowsazure.com/en-us/manage/services/cache/net/how-to-in-role-cache/) which was the base of our POC.
In the first attempt we used this code to get default cache
DataCacheFactory cacheFactory = new DataCacheFactory(); DataCache cache = cacheFactory.GetDefaultCache();In the second attempt (after noticing this performance problem) we tried this code excerpt
DataCache cache = new DataCache("default");AND it was faster than SQL query about 2 times (certainly we'll gain more against if we have multiple SQL queries). We realized that the GetDefaultCache() function caused this problem, especially when it's under heavy loading.