NHibernate Azure AppFabric 缓存

发布于 2024-11-04 19:42:08 字数 127 浏览 0 评论 0原文

有人尝试过使用 NHibernate Velocity L2 缓存提供程序来对抗 Azure AppFabric 缓存吗?如果是这样,你发现了什么?

附带说明一下,我们使用 SQL Azure 来存储数据。

Has anyone tried using the NHibernate Velocity L2 cache provider against the Azure AppFabric Cache? If so, what did you discover?

On a side note, we're using SQL Azure to store our data.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

十级心震 2024-11-11 19:42:08

最新版本的“Windows Azure 缓存(预览版)”应该可以帮助您 - http://social.msdn.microsoft.com/Forums/en-US/windowsazuredata/thread/9a2dbd9f-1b9d-4249-a48b-216d9dfdc2bc

您支持通知、改进的延迟、更大的灵活性和定价仅基于您配置的虚拟机的计算成本。

The latest release "Windows Azure Caching (Preview)" should help you - http://social.msdn.microsoft.com/Forums/en-US/windowsazuredata/thread/9a2dbd9f-1b9d-4249-a48b-216d9dfdc2bc

You have support for Notifications, improved latencies, greater flexibility and pricing only based on Compute cost of the VMs you configure with.

后eg是否自 2024-11-11 19:42:08

我们的缓存用例如下:

  1. 我们希望通过缓存经常访问的 SQL Azure 数据来加速我们的 Web 应用程序。
  2. 应该通过简单地编辑 NHibernate 配置来启用缓存(就像任何其他 NHibernate L2 缓存一样)。
  3. 当对 Azure 角色实例上的这些实体之一进行更新时,更改应立即传播到其他 Azure 实例。
  4. 我们希望避免设置和管理像 memcached 这样的东西的麻烦。

不幸的是,Azure AppFabric 缓存的当前状态不适合我们的需求。原因如下:

调整 NHibernate Velocity 提供程序后,我们能够在分布式缓存中缓存对象,但访问每个实体时有一个小延迟(约 1 秒)。因为我们尝试每个 Web 请求访问数百个缓存对象,所以每个 HTTP 请求实际上比我们直接访问数据库要慢 - 当然不是我们想要的。

我们尝试通过启用 AppFabric 本地缓存来解决此问题。性能得到了极大的提高,但这又带来了另一个问题。一旦对象被存储到本地缓存中,它将一直保留在那里直到过期(您可以为缓存设置过期时间)。此时,AppFabric 本地缓存和 NHibernate SysCache 提供程序(使用 ASP.NET 缓存)之间没有太大区别,只是您必须为 AppFabric 缓存支付额外费用。

如果 Azure AppFabric 本地缓存支持通知(例如其 Windows Server AppFabric 同类),我们很乐意使用 Azure 缓存。请在 www.mygreatwindowsazureidea.com 上为该功能投票。

作为参考,同事 在 Azure 论坛上发布了一个有关 AppFabric 本地缓存使用的问题

如果有人发现 MS 在 Azure 上启用了本地缓存通知,请发布我原来问题的答案。

Our use case for caching is listed as follows:

  1. We want to speed up our web application by caching frequently accessed SQL Azure data.
  2. The cache should be enabled by simply editing the NHibernate config (just like any other NHibernate L2 cache).
  3. When an update is made to one of these entities on an Azure role instance, the change should immediately propagate to the other Azure instances.
  4. We would like to avoid the hassle of setting up and managing something like memcached.

Unfortunately, the current state of the Azure AppFabric Cache doesn't suit our needs. Here's why:

After tweaking the NHibernate Velocity provider, we were able to cache objects in the distributed cache, but there was a small delay (~1second) when accessing each entity. Because we were trying to access hundreds of cached objects per web request, each HTTP request was actually slower than if we accessed the DB directly - certainly not what we were looking for.

We tried to fix this issue by enabling the AppFabric local cache. The performance was drastically improved, but this raised another problem. Once an object is stored in the local cache, it will stay there until it expires (you can set an expiration timespan for the cache). At this point, there isn't much difference between the AppFabric local cache and the NHibernate SysCache provider (which makes use of the ASP.NET Cache), except that you have to pay extra for the AppFabric cache.

If the Azure AppFabric local cache supported notifications like its Windows Server AppFabric cousin, we'd be happily using the Azure cache. Please vote for this feature at www.mygreatwindowsazureidea.com.

For reference, a co-worker posted a question on the Azure forums concerning the use of the AppFabric local cache.

If anyone discovers that MS has enabled local cache notifications on Azure, please post an answer to my original question.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文