在辅助角色中使用实例计数

发布于 2024-10-10 10:32:28 字数 83 浏览 0 评论 0原文

在辅助角色中使用多个实例时,不会出现线程同步问题。我的疑问是两个实例是否可能尝试选择相同的记录并处理相同的记录。如何解决这个问题。

谢谢

While using multiple instances in worker role will there not be thread synchronization issues. My doubt is whether two instances might try to pick the same record and process the same. How to solve this issue.

Thanks

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

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

发布评论

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

评论(3

甜尕妞 2024-10-17 10:32:28

不是线程问题,而是并发问题。是的,会有问题。

但是,这些问题与普通并发问题没有什么不同,即使是单个 Web 服务器接收同时请求时也可能会遇到这种问题。

处理并发问题的最常见方法是使用 乐观并发

Not threading issues, but concurrency issues. Yes, there will be issues.

However, these issues are not different from normal concurrency issues that you might have with even a single web server receiving simultaneous requests.

The most common way to deal with concurrency issues is through the use of Optimistic Concurrency.

静水深流 2024-10-17 10:32:28

Windows Azure 平台中用于将工作分配给多个工作进程的常见解决方案是使用 Azure 存储队列。这有助于最大限度地降低两个线程甚至两个角色同时处理单个项目的风险。但是,需要做一些额外的工作才能使其完全发挥作用并确保正确考虑队列行为。

a common solution within the Windows Azure Platform for allocating work out to multiple worker processes is the use of Azure Storage Queues. This helps minimize the risk of two threads or even two roles working on a single item concurrently. However, there is a wee bit of additional work that is required to make this fully functional and ensure that the queue behavior is properly accounted for.

财迷小姐 2024-10-17 10:32:28

我不建议使用多个单线程角色以避免线程。它会更昂贵,正如@Mark 所指出的,你最终将面临几乎相同的问题。

I wouldn't recomend use multiple single-thread roles in order to avoid threading. It would be more expensive, and as @Mark has pointed out, you will end facing almost the same problems.

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