本文介绍了Azure的队列创建最佳实践及规模的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在找成在Windows Azure上高档次的web应用程序的性能(在这一点上理论值)的架构,想挑你的大脑有关Windows Azure的队列(不是SB),以及如何最好地规模/创建它们。

I’m looking into an architecture for high scale web performance application (theoretical at this point) on Windows Azure and wanted to pick your brains about "Windows Azure Queues (not SB)" and how best to scale/create them.

我基本上看MVC前端(Web角色),Windows Azure的队列(异步消息脱钩),工作者角色和熏黑的SQL数据库。

I’m basically looking at MVC front-end (Web Role), Windows Azure Queues (async message decoupling), Worker Role and blackened SQL DB.

我的理解是,我们收到关于Web角色的消息,然后将它传递给一个队列,辅助角色将轮询队列{做的工作......如SQL数据库CRUD操作},并发送回一个完成消息。

My understanding is that we receive a message on the Web Role and then pass it to a Queue, the Worker Role will poll the queues {do work… e.g SQL DB CRUD operation} and send back a completion message.

什么是处理在Windows Azure队列创建了规模,也传递消息来回通过Web角色和辅助角色的最佳方法?它是最好有一个队列发送例如工作订单,然后另一个队列的通知例如状态消息

What is the best way to handle the Windows Azure queue creation for scale and also passing the messages back and forth via the Web Role and the Worker Role? Is it best to have one queue for sending work e.g. orders and then another queue for notification e.g. status message

我看过很多帖子说,你应该申请code之外创建队列,是有道理的,但你如何扩展这与当前队列限制的可扩展性目标,一个Windows Azure的队列约束500事务/秒?

I have seen a lot of posts say that you should create your queues outside of your application code, makes sense but how do you scale this with the current Queue limitation "scalability target for a single Windows Azure queue is "constrained" at 500 transactions/sec"?

在MSDN有一些伟大的资源,通过左右缩放队列

The MSDN has some great resources about scaling via queues.

•角色实例扩展是指添加和删除其他Web或工作者角色实例来处理点即时工作量。这通常包括在服务配置改变实例计数。增加实例计数会导致Windows Azure中运行时启动新的实例,而减少实例计数又会导致它关闭正在运行的实例。

• Role instance scaling refers to adding and removing additional web or worker role instances to handle the point-in-time workload. This often includes changing the instance count in the service configuration. Increasing the instance count will cause Windows Azure runtime to start new instances whereas decreasing the instance count will in turn cause it to shut down running instances.

•过程(螺纹)缩放是指通过调节线程数上下根据当前的工作负荷在给定的角色实例的处理线程方面保持足够的容量。

• Process (thread) scaling refers to maintaining sufficient capacity in terms of processing threads in a given role instance by tuning the number of threads up and down depending on the current workload.

总之我在寻找答案,下面的问题:

In short I’m looking for answers to the below questions:


  1. 队列创建最佳实践?

  2. 如何在Web角色(MVC应用程序)跟踪的信息,即它轮询通知队列一旦它已通过邮件了,有什么处理的Web角色的消息相关的最佳方式传送回客户端(网络消费者)?

  3. 在上面,最好的办法缩放选项或者我应该看的飞行队列的动态缩放(如果又如何?我想SB队列可能是在这种情况下更好的)创建新的队列,以规避交易500 /秒的限制吗?

如前所述我的问题是在这个时刻更多的理论,我想建筑师和面向未来的任何解决方案向前发展。

As stated my questions are more theoretical at this moment in time, I want to architect and future proof any solution going forward.

感谢

推荐答案

有关的,你如何跟踪响应的问题,我通常做到以下几点:

For the question of how do you track responses, I usually do the following:


  1. Web角色中写入一条消息,其中包括一个作业ID的队列中。

  2. 工作者角色做的工作,并将结果与​​分区键写入的表。

  3. 网络的作用是查询该行的表中。一旦它的存在,答案回来。

话又说回来,如果这是一个用户交互的东西,用户实际上是在等待一个开放的HTTP连接上得到的结果,你可能会更好只使用同步通信和跳过队列。

Then again, if this is a user-interactive thing, where the user is actually waiting on an open HTTP connection to get the result, you may be better off just using synchronous communication and skipping the queue.

如果我是你,我至少来看看使用类似0MQ(ZeroMQ,或者它的新的分支十字路口I / O),它给你的原始套接字的顶部,可以对这项有益的漂亮抽象那类的东西。例如,Web服务器通过PUSH套接字发送消息,辅助角色通过抽拉插口接收,辅助角色通过PUB插座发布响应,以及​​Web角色获得通过SUB插口的响应。在推/拉做负载均衡,以及PUB / SUB把手得到消息返回到等待Web角色。仅供参考,这正是消息的架构和技术,通过Mongrel2使用。

If I were you, I'd at least take a look at using something like 0MQ (ZeroMQ, or its new fork Crossroads I/O), which gives you nice abstractions on top of raw sockets that can be useful for this sort of thing. E.g., web servers send messages via PUSH sockets, worker roles receive via PULL sockets, worker roles publish responses via PUB sockets, and web roles receive the responses via SUB sockets. The PUSH/PULL does load balancing, and the PUB/SUB handles getting the message back to the waiting web role. FYI, this is exactly the messaging architecture and technology used by Mongrel2.

在获得超过每秒500操作方面,你可以创建多个队列和随机喷洒信息给他们。 (每个工人通常会轮询所有的人。)但是请记住,一个单一的存储帐户每秒5000操作的限制,所以你创建10队列后,你需要创建一个新的存储帐户来获得更有保证的可扩展性。

In terms of getting beyond 500 operations per second, you can just create multiple queues and spray messages to them randomly. (Each worker would typically poll all of them.) But keep in mind that a single storage account has a limit of 5,000 operations per second, so after you've created 10 queues, you'll need to create a new storage account to get more guaranteed scalability.

这篇关于Azure的队列创建最佳实践及规模的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 05:54
查看更多