Azure的角色间同步 [英] Azure inter-role synchronization

查看:127
本文介绍了Azure的角色间同步的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道在同步运行相同角色的多个实例,湛蓝的最佳实践。
更多precisely,我想prevent几个辅助角色在同一工作单位上工作。

I was wondering about the best practices in synchronizing multiple azure instances that run the same role. More precisely, I want to prevent several worker roles to work on the same work-unit.

Azure的队列似乎并没有帮助这个问题。
一种选择是使用带有锁和存储过程SQL表;但是在Azure中使用SQL同步似乎有点尴尬。

Azure queues do not seem to help on this matter. One option is to use an sql table with locks and stored procedures; but using sql synchronization in Azure seems a bit awkward.

任何想法?

编辑,我详细的(但简单的问题)如下:

Edit, my detailed(but simplified problem) is as follows:


  • N 目标。

  • 工作的单位必须在每个目标在指定的时间间隔做(说30秒 - 但它是每个目标不同)

  • 我的 M 人员(在美国举行的 ^ h 实例)。

  • 处理工作单元可能需要10秒到1小时之间的任何东西。

  • There are n targets.
  • A unit of work must be done on each target at a specified interval (say 30 seconds - but it is different for each target).
  • I have m workers (hosted in h instances).
  • Processing a unit of work could take anything between 10 seconds and 1 hour.

的想法是,我有一个调度这让工作单位在Azure的队列,每个的 M 工人将阅读这些并处理它们。

The idea is that I have a scheduler that puts units of work in an Azure queue, and each of the m workers will read these and process them.

问题:


  • worker1 在开始工作的 1单元(这是关于目标1 ) - 此人会需要很长时间,例如10分

  • 经过30秒

  • 调度提出另一个单位工作,为的目标1 ,说的 unit13

  • worker2 开始工作的 unit13 ,对同一目标1 - 不好

  • worker1 starts working on unit1 (which is regarding target1) - this one will take long, say 10 minutes
  • 30 seconds pass
  • the scheduler puts another unit of work for target1, say unit13
  • worker2 starts working on unit13, against the same target1 - not good

我有一些想法,但他们似乎并没有的阴天的不够,所以我很有兴趣看你申请什么方案来解决这个问题。

I have some ideas, but they don't seem cloudy enough, so I am interested to see what solutions would you apply for this problem.

推荐答案

我刚写的关于使用一滴租赁做这样的事情一对夫妇的博客文章。请参见 http://blog.smarx.com/posts/管理并发功能于Windows的蔚蓝与 - 租赁和的 http://blog.smarx.com/posts/building-a-task-scheduler-in-windows-azure

I've just written a couple blog posts about using blob leases to do this sort of thing. See http://blog.smarx.com/posts/managing-concurrency-in-windows-azure-with-leases and http://blog.smarx.com/posts/building-a-task-scheduler-in-windows-azure.

这篇关于Azure的角色间同步的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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