Azure-减慢多实例的Windows Azure缓存的替代方法 [英] Azure - Alternative method to slow Windows Azure Caching for multi instances

查看:74
本文介绍了Azure-减慢多实例的Windows Azure缓存的替代方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们当前将现有的Web应用程序移至Azure. Azure缓存非常慢.

We current move our existing web application to Azure. Azure Caching is very slow.

Azure中的多个实例是否有任何 替代缓存机制 (优于Azure缓存)?例如,将缓存存储在Azure存储或Azure SQL中.

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.

谢谢您的输入!

已添加

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);

推荐答案

通常,WA缓存不是很慢,特别是如果您打开本地缓存"(通常应将延迟降低) (只要数据适合存储在内存中),时间大约为0毫秒). Memcached是另一种可能性: http://blog.smarx.com/posts/memcached- in-windows-azure .

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.

您不会在WA Caching和Memcached之间发现性能上的数量级差异,但是以我的经验,Memcached更快一些.不过,Memcached 不会能够胜过WA Caching中的本地缓存"功能,因为这实际上没有任何延迟. (这是不进行序列化的过程中数据访问.尽可能地提高效率.)

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.)

这篇关于Azure-减慢多实例的Windows Azure缓存的替代方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆