在所有的Azure实例刷新数据 [英] Refreshing Data on all Azure Instances

查看:155
本文介绍了在所有的Azure实例刷新数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是刷新在我所有的Azure实例数据的最佳方式?

What is the best way to refresh the data in all my Azure instances?

我在每次运行相同的Web角色多个实例。在角色启动数据从Blob存储到本地存储读取。间歇性地将有新的更新网站使用数据。我希望能够以编程方式通知每个实例从Blob存储更新的数据进入实例的本地存储,以便每个实例变得精神焕发。

I have several instances each running the same web role. On role startup data is read from blob storage into local store. Intermittently there will be a new update to data used by the site. I want to be able to notify each instance programmatically to get the updated data from blob storage into the instance's local storage so that each instance becomes refreshed.

一个想法是编写一个自定义客户端程序来调用Web角色的Web服务,传递一个角色ID进行更新。如果端点是角色ID,然后在该实例刷新本身。如果没有客户端再次尝试,直到所有实例报告说,他们被刷新。这是一个很好的做法还是有一个内置的方法在Azure中这样做?

One idea is to write a custom client program to call a web-service on the web role, passing in a role ID to update. If the endpoint is the Role ID then the instance refreshes itself. If not the client tries again until all instances report that they are refreshed. Is this a good approach or is there a built in method in Azure for doing this?

我考虑一个单独的线程,间歇检查的刷新标志,虽然我很担心我的情况下,将成为不同步。

I have considered a separate thread which intermittently checks for an refresh flag, though I'm worried my instances will become out of sync.

有没有一个庞大的数据量,所以我可以把它放在Azure的缓存。不过,我担心使用缓存的网络延迟。是否在Azure缓存处理这口井?

There is not a huge amount of data so I could put it in the Azure cache. However, I am concerned about the network latency with using the cache. Does the Azure cache handle this well?

另一个想法是只要重启又一个实例之一(另外两个的角色正在执行的刷新操作启动)。

Another idea is to just reboot the instances one after another (with the refresh operation being performed on the role start up).

推荐答案

添加到斯图尔特的回答,让我解决您提出的技术:

Adding to Stuart's answer, let me address your proposed techniques:


  • 我不认为客户端调用的Web服务技术是可行的,因为你现在已经添加了一个Web服务以及客户机驱动程序调用它,你有没有能力去联系各个Web角色实例 - 负载平衡器从你隐藏单个实例

  • 您可以将数据存储在缓存中,而是要更新数据的唯一途径现在是过期的缓存项。如果你把所有与某知名重点单个缓存项数据,那么它很容易过期。如果是跨多个密钥,那么你有一个更复杂的任务,你将无法原子到期的项目(除非您清除整个缓存)。另外,高速缓存自身的到期反正 - 你必须处理重新加载,如果发生

  • 您可以使用您的角色实例的后台线程,这看起来是为blob(也许用一个zip文件),并复制下来的zip到本地存储时,其ID改变(你可以在BLOB的存储一个唯一的ID元数据,例如)。然后,你可以只检查该定期(也许每分钟?)。

  • 重新引导想法有好的一面和不好的一面。在好的一面,你要避免因改变本地内容,而你的角色实例仍在运行的副作用。不好的一面是,角色实例将为重启期间几分钟下线。

使用配置设置的斯图尔特的建议是一个很好的一个。只要确保你可以更新你的文件没有打破您的应用程序。如果无法安全进行,不办理变更事件 - 只是让角色实例回收

Stuart's suggestion of using a configuration setting is a good one. Just be sure you can update your files without breaking your app. If this cannot be done safely, don't handle the Changing event - just let the role instance recycle.

这篇关于在所有的Azure实例刷新数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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