Posts

Showing posts from August, 2013

Caching is not as easy as you think it is

For the past year I have been playing around with azure caching and learning a lot. I have got frustrated, confused and then finally there seems to be light at the end of the tunnel. This is what I've learnt from my experience so far: 1. I have no idea why they allow co-located caching because if you are having a decent sized cache with lots of reads and writes, this is unusable. Use dedicated cache role - only that can handle significant load. 2. Caching which uses BLOB storage as a persistence mechanism has problems if it accesses BLOB storage frequently because items are not remaining in the cache. I was flummoxed by this problem but worked around it because in my case, I was able to get away with checking for the existence of the BLOB which is much faster than trying to download it every time (my data just requires the existence check). 3. Don't be unhappy with your code if you have x-small and small instances and your sites with caching roles do not perform well.

c# async method without a real await supported method called within it.

Have been searching for this since a long time. Finally found it: http://stackoverflow.com/questions/15522900/how-to-safely-call-an-async-method-in-c-sharp-without-await public   async   static   Task < int > GetTwitterResultsCountAsync( string  itemLink)         {              int  returnCount =  await   Task .Run< int >(() =>             {                  int  count = 0;                  try                 {                     count = ( from  search  in   TwitterLog .TwitterContext.Search                               where  search.Type ==  SearchType .Search &&                                    search.Query == itemLink                               select  search).Count();                      return  count;                 }                  catch                 {                      return  count;                 }             });              return  returnCount;         } Just a note - these methods work fine when called from a asp.ne