简体   繁体   English

在Azure云中轮询时从亲缘关系逃脱

[英]Escaping from Affinity while Polling in the Azure Cloud

I am trying to build an application in Windows Azure that requires notifications - so I am using Http Polling, but I got a problem. 我正在尝试在Windows Azure中构建需要通知的应用程序-所以我正在使用Http Polling,但是遇到了问题。 I need to get to the very same instance of my web role so I can maintain the polling. 我需要访问我的Web角色的同一实例,以便维护轮询。 I found a solution with web farm request rewriting(adding extra proxy role), but I don't like the solution. 我找到了使用Web场请求重写的解决方案(添加了额外的代理角色),但是我不喜欢该解决方案。

Soo my question: Is there a way to do stateless polling and if there is someone that implemented this - can you give me a hint or link? 我的问题就这样:有没有办法进行无状态轮询,并且如果有人实施了这种轮询-您能给我一个提示或链接吗?

You just need the poll request to thunk through to some sort of shared 'stateful' layer. 您只需要轮询请求即可处理某种共享的“有状态”层。 Probably the best candidate would be to use the Windows Azure caching service. 最好的选择可能是使用Windows Azure缓存服务。 http://www.windowsazure.com/en-us/home/tour/caching/ you could also just use storage and choosing between the two will largely be determined by how busy your app is; http://www.windowsazure.com/zh-cn/home/tour/caching/您也可以只使用存储,在这两者之间进行选择在很大程度上取决于应用程序的繁忙程度; ie whether it is cheaper to pay a fixed cost for some cache space with no per request charge or pay almost nothing for your storage space but pay a per request charge. 也就是说,为固定的缓存空间支付固定费用而无需按请求收费,还是为您的存储空间几乎不支付任何费用,而是按请求收费,是比较便宜的。

By taking this approach it does not matter if susequent polling requests end up routed to a different instance. 通过采用这种方法,连续的轮询请求最终是否路由到其他实例并不重要。 To me this is best practice regardless; 对我而言,这是最佳做法,无论如何; I've seen some fugly bugs pop up when people assume session affinity when making AJAX calls back into an Azure web role. 我看到人们在将AJAX回调回Azure Web角色时假定会话关联时会弹出一些难看的错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM