Reputation: 62260
We current move our existing web application to Azure. Azure Caching is very slow.
Is there any alternative caching mechanism (better than Azure Caching) for multi instances in Azure? For example, storing caching in Azure Storage or Azure SQL.
Thank you for your input!
Added
public class AzureCacheService : ICacheService
{
readonly DataCacheFactory _factory = new DataCacheFactory();
private readonly DataCache _cache;
public AzureCacheService()
{
_cache = _factory.GetDefaultCache();
}
public object Get(string key)
{
return _cache.Get(key);
}
public void Insert(string key, object obj)
{
if (obj != null)
{
_cache.Put(key, obj, new TimeSpan(3, 0, 0));
}
}
public void Remove(string key)
{
_cache.Remove(key);
}
}
*** Accessing ***
IoC.Resolve<ICacheService>().Insert(key, MyObject);
IoC.Resolve<ICacheService>().Remove(key);
Upvotes: 0
Views: 950
Reputation: 11
You can use the recently released Windows Azure Caching (Preview). It has 5x improvement over the shared caching counterpart.
Link : http://www.windowsazure.com/en-us/develop/net/how-to-guides/cache/
Upvotes: 0
Reputation: 20556
It was my misunderstanding that Windows Azure Caching is based on SQL Azure and after taking to correct resources I was able to verify that it sure is inmemory cache. so if you decide to write your own using SQL Azure, that would be much slower the what you are already getting now and same goes with Azure Table storage. [Rest of the comment is removed]
Upvotes: 0
Reputation: 60143
In general, WA Caching is not slow, particularly if you turn on "local caching" (which should generally turn the latency down to around 0ms, as long as the data fits in memory). Memcached is another possibility: http://blog.smarx.com/posts/memcached-in-windows-azure.
You won't find an order-of-magnitude difference in performance between WA Caching and Memcached, but in my experience Memcached is a little faster. Memcached won't be able to beat the "local caching" feature in WA Caching, though, since there's literally no latency on that. (It's in-proc data access without serialization. Just about as efficient as is possible.)
Upvotes: 2