本文介绍了表现不佳与蔚蓝的缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

切换几个数据库的调用缓存之后,我们实际上有更差的性能。我们注意到,根据新的遗物一个巨大的跳跃在CLR时间和响应时间。请参阅所附的跳跃图形(缓存引入1/5 0:00)。已更改的的只有的事情已经推出的Azure应用程序面料缓存。我们缓存客户端使用Singleton模式所以只有一个用于Web服务的实例。所以我们不是EN-固化每次打开连接的开销缓存工厂创建一次,然后存储起来。

After switching a couple of database calls to cache, we actually had worse performance. We noticed a huge jump in CLR time and response time according to new relic. Please see attached graph for the jump (cache was introduced 1/5 at 0:00). The only thing that has changed has been the introduction of Azure App Fabric Cache. Our cache client uses a singleton pattern so there is only one for the instance of the webservice. the cache factory is created once and then stored away so we are not en-curing the overhead of opening the connection each time.

此外,报告NewRelic的高速缓存的平均耗时15毫秒。在许多情况下,为15ms可以比数据库慢!!!!

Furthermore, NewRelic reports that cache is taking on average 15ms. In many cases, 15ms can be slower than the database!!!!

NTO我们坚持我缓存两个字节数组的constits的对象,一有大约421的长度和其他具有8的长度。

nto The object we are sticking i cache constits of two byte arrays, one has a length of about 421 and the other has a length of 8.

没有真正理解为什么引进缓存我们看到增加的响应时间。是一个字节数组不缓存友好吗?

Not really understanding why with the introduction of cache we see increased response time. Is a byte array not cache friendly?

我的课看起来是这样的(唯一的两个属性,获取填充被塞进级之前是两个字节数组一切留给默认值)

my class looks like this (the only two properties that get populated prior to being shoved into class is the two byte arrays everything else is left to default values)

[Table]
public class GameState
{
    [Column(IsPrimaryKey = true, IsDbGenerated = true, AutoSync = AutoSync.OnInsert)]
    public int Id { get; set; }

    [Column(UpdateCheck = UpdateCheck.Never, Name = "game_id")]
    public int GameId { get; set; }

    [Column(UpdateCheck = UpdateCheck.Never, Name = "player_id")]
    public int PlayerId { get; set; }

    [Column(UpdateCheck = UpdateCheck.Never, DbType = "VarBinary(max)")]  //has a length around 421
    public byte[] State { get; set; }

    [Column(UpdateCheck = UpdateCheck.Never, IsDbGenerated = true, AutoSync = AutoSync.OnInsert)]
    public DateTime Created { get; set; }

    [Column(UpdateCheck = UpdateCheck.Never, Name = "update", IsDbGenerated = true, DbType = "timestamp")] //has a length of 8
    public byte[] TimeStamp { get; set; }
}

感谢

更新

我们采访了一些微软的工程师,没有人可以给我们任何帮助,为什么它这么慢。一位工程师报告说,高速缓存层是建立在SQL Azure的顶部能够解释高要求次。另一个工程师否认索赔,但不完全确定共享缓存是如何实现的。

We talked with several Microsoft engineers and no one could give us any help as to why it was so slow. One engineer reported that the cache layer was built on top of SQL Azure which explained the high request times. Another engineer denied that claim, but wasn't exactly sure how Shared Caching was implemented.

我们从来没有能够得到蔚蓝的高速缓存可快速工作,最终从Azure的切换到亚马逊EC2。一旦可比硬件Amazon EC2上我们响应时间下降到约60-70ms。

We were never able to get the azure cache working quickly and ultimately switched from Azure to Amazon ec2. Once on Amazon ec2 on comparable hardware our response time dropped to about 60-70ms.

有关任何人在考虑这一点,这是我们在交换机学习。

For anyone else in considering this, this was what we learned in the switch.

SQL Azure是共享DB托管。你没有得到你自己的DB你是在和一帮其他数据库的服务器,如果您有任何像样的交通,你会得到节流。他们不停地告诉我们,一些购票成功的故事,但在这种情况下他们有750 DB的处理的事务。分片是没有乐趣,和更好的成功故事是,你处理了所有这些要求以1dB。

SQL Azure is shared DB hosting. You do not get your own DB you are in a server with a bunch of other DB's and if you have any kind of decent traffic, you will get throttled. They kept telling us about some ticket purchasing success story, but in that scenario they had 750 DB's to process the transactions. Sharding is no fun, and a better success story is that you handled all those requests with 1DB.

我们使用SSL,以及具有IIS管理SSL真的杀死你的CPU。亚马逊有你的ELB做SSL,然后在IIS框不就得了。这释放了IIS箱更快的处理请求。

We use SSL, and having IIS manage the SSL really kills your CPU. Amazon has your ELB do the ssl and then your IIS boxes don't have to. This freed up the IIS boxes to handle requests faster.

亚马逊可以让你运行的memcache。 Memcache的是真棒。有一个闪电快速缓存层(能成长远远超出4GB的),把巨大的负荷了我们的数据库。

Amazon lets you run memcache. Memcache is awesome. Having a lightening fast cache layer (capable of growing well beyond 4GB), took tremendous load off our DB.

我们回到2012年1月做了开关,所以其可能的Azure已经成为去年好,但是,我有给它第二次机会没有任何计划。

We made the switch back in jan 2012, so its possible Azure has become better in the last year, however I have no plans on giving it a second chance.

推荐答案

Azure的缓存的性能是不是满意。基本上,这是因为在Azure缓存有它自己的负载均衡时的通讯方式。但是你可以尝试启用本地缓存功能,这将增加负载的性能。

The performance of Azure Cache is not that satisfied. Basically it's because the Azure Cache has its own load balance when communicate. But you can try to enable the local cache feature, which will increase the load performance.

这篇关于表现不佳与蔚蓝的缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-30 00:01