NServiceBus之Distributor

来源:互联网 发布:淘宝运营需要会什么 编辑:程序博客网 时间:2024/05/16 17:52

Similar in behavior to standard load balancers the NServiceBus Distributor is the key to scaling out message processing over many machines transparently.


Why use it

When starting to use NServiceBus, you'll see that you can easily run multiple instances of the same process with the same input queue. This may look like scaling-out at first, but is really no different than running multiple threads within the same process. If you try to do this with multiple machines, you'll see that you can't share a single input queue across multiple machines.

The distributor gets around this limitation.

当启动NServiceBus的时候,你会发现不能够很容易地在一个同样的输入队列上运行同一个进程的多个实例。者也许开始看起来像是横向拓展,但是实际上这不同于在同一个进程中运行多个线程。假如你尝试去在多个机器上这样做,你就会发现你不能跨越多个机器共享单个输入队列。

分发者绕开了这个限制。(无法跨越多个机器共享单个输入队列,意思是要想跨越多个机器,还是需要借助Gateway???

How does it work

Worker nodes send messages to the distributor, telling it when they're ready for work. These messages arrive at the distributor via a separate 'control' queue. The distributor stores this information.

When applicative messages arrive at the distributor, it uses the previously stored information to find a free worker node, and sends the message on to it.

If no worker nodes are free, the distributor waits a bit and then repeats the previous step.

This way, all pending work stays in the distributor's queue (rather than building up in each of the workers' queues) giving visibility into how long messages are actually waiting. This is important for complying with time-based service level agreements (SLAs).

For more information on monitoring, see Monitoring NServiceBus Endpoints.



这句话实在搞不懂:

Keep in mind that the distributor is designed for load balancing within a single site and should not be used between sites. In the image above, all publishers and subscribers are within a single physical site.

For information on using NServiceBus across multiple physical sites, see the gateway.

分发者是设计用于单个site的,不能用用于两个site之间,下图中所有发布者和订阅者都在单个物理site中。





参考: http://support.nservicebus.com/customer/portal/articles/859556-load-balancing-with-the-distributor

原创粉丝点击