简体   繁体   English

Azure 服务总线队列性能

[英]Azure Service Bus Queue Performance

I am using the Azure service bus queue for one of my requirements.我正在使用 Azure 服务总线队列来满足我的一项要求。 The requirement is simple, an azure function will act as an API and creates multiple jobs in the queue.要求很简单,一个 azure 函数将充当 API 并在队列中创建多个作业。 The function is scalable and on-demand new instance creation.该功能是可扩展的,可按需创建新实例。 The job which microservice creates will be processed by a windows service.微服务创建的作业将由 Windows 服务处理。 So the sender is Azure function and the receiver is windows service.所以发送方是 Azure 函数,接收方是 windows 服务。 Since the azure function is scalable, there will be multiple numbers of functions will be executed in parallel.由于 azure 函数是可扩展的,因此会有多个函数并行执行。 So, the number of jobs getting created into the queue will be in parallel, and probably one job in every 500MS.因此,创建到队列中的作业数量将是并行的,每 500 毫秒可能有一个作业。 Windows service is a single instance that is a Queue listener listens to this Queue and executes in parallel. Windows 服务是单个实例,它是一个队列侦听器,侦听此队列并并行执行。 So, the number of senders might be more, the receiver is one instance.所以,发送者的数量可能更多,接收者是一个实例。 And each job can run in parallel must be limited(4, since it takes more time and CPU) Right now, I am using Aure Service Bus Queue with the following configuration.并且每个作业可以并行运行必须受到限制(4,因为它需要更多的时间和 CPU) 现在,我正在使用具有以下配置的 Aure 服务总线队列。 My doubt is which configuration produces the best performance for this particular requirement.我怀疑哪种配置可以为这个特定要求产生最佳性能。

The deletion of the Job in the queue will not be an issue for me.删除队列中的作业对我来说不是问题。 So, Can I use Delete instead of Peek-Lock?那么,我可以使用 Delete 而不是 Peek-Lock 吗?

Also, right now, the number of items receiving by the listener is not in order.此外,现在,听众接收的项目数量不正常。 I want to maintain an order in which it got created.我想维护一个创建它的顺序。 My requirement is maximum performance.我的要求是最大的性能。 The job is done by the windows service is a CPU intensive task, that's why I have limited to 4 since the system is a 4 Core.由 Windows 服务完成的工作是一项 CPU 密集型任务,这就是为什么我限制为 4,因为系统是 4 核。

Max delivery count: 4, Message lock duration: 5 min, MaxConcurrentCalls: 4 (In listener).最大传递计数:4,消息锁定持续时间:5 分钟,MaxConcurrentCalls:4(在侦听器中)。 I am new to the service bus, I need a suggestion for this.我是服务总线的新手,我需要一个建议。

One more doubt is, let's consider the listener got 4 jobs in parallel and start execution.还有一个疑问是,让我们考虑侦听器并行获得 4 个作业并开始执行。 One job completed its execution and became a completed status.一项作业完成执行并成为已完成状态。 So the listener will pick the next item immediately or wait for all the 4 jobs to be completed (MaxConcurrentCalls: 4).因此侦听器将立即选择下一个项目或等待所有 4 个作业完成 (MaxConcurrentCalls: 4)。

The deletion of the Job in the queue will not be an issue for me.删除队列中的作业对我来说不是问题。 So, Can I use Delete instead of Peek-Lock?那么,我可以使用 Delete 而不是 Peek-Lock 吗?

Receiving messages in PeekLock receive mode will less performant than ReceiveAndDelete .PeekLock接收模式下接收消息的性能将低于ReceiveAndDelete You'll be saving roundtrips to the broker to complete messages.您将保存往返代理以完成消息。

Max delivery count: 4, Message lock duration: 5 min, MaxConcurrentCalls: 4 (In listener).最大传递计数:4,消息锁定持续时间:5 分钟,MaxConcurrentCalls:4(在侦听器中)。 I am new to the service bus, I need a suggestion for this.我是服务总线的新手,我需要一个建议。

MaxDeliveryCount is how many times a message can be attempted before it's dead-lettered. MaxDeliveryCount是消息在死信之前可以尝试的次数。 It appears to be equal to the number of cores, but it shouldn't.它似乎等于核心数,但不应该。 Could be just a coincidence.可能只是巧合。

MessageLockDuration will only matter if you use PeekLock receive mode. MessageLockDuration只有在您使用PeekLock接收模式时才重要。 For ReceiveAndDelete it won't matter.对于ReceiveAndDelete没有关系。

As for Concurrency, even though your work is CPU bound, I'd benchmark if higher concurrency would be possible.至于并发性,即使您的工作受 CPU 限制,我也会对是否有可能实现更高的并发性进行基准测试。

An additional parameter on the message receiver to look into would be PrefetchCount .要查看的消息接收器上的另一个参数是PrefetchCount It can improve the overall performance by making fewer roundtrips to the broker.它可以通过减少与代理的往返次数来提高整体性能。

One more doubt is, let's consider the listener got 4 jobs in parallel and start execution.还有一个疑问是,让我们考虑侦听器并行获得 4 个作业并开始执行。 One job completed its execution and became a completed status.一项作业完成执行并成为已完成状态。 So the listener will pick the next item immediately or wait for all the 4 jobs to be completed (MaxConcurrentCalls: 4).因此侦听器将立即选择下一个项目或等待所有 4 个作业完成 (MaxConcurrentCalls: 4)。

The listener will immediately start processing the 5th message as your concurrency is set to 4 and one message processing has been completed.当您的并发设置为 4 并且一条消息处理已完成时,侦听器将立即开始处理第 5 条消息。

Also, right now, the number of items receiving by the listener is not in order.此外,现在,听众接收的项目数量不正常。 I want to maintain an order in which it got created.我想维护一个创建它的顺序。

To process messages in the order they were sent in you will need to send and receive messages using sessions .要按照消息发送的顺序处理消息,您需要使用会话来发送和接收消息。

My requirement is maximum performance.我的要求是最大的性能。 The job is done by the windows service is a CPU intensive task, that's why I have limited to 4 since the system is a 4 Core.由 Windows 服务完成的工作是一项 CPU 密集型任务,这就是为什么我限制为 4,因为系统是 4 核。

There are multiple things to take into consideration.有很多事情需要考虑。 The location of your Windows Service location would impact the latency and message throughput. Windows 服务位置的位置会影响延迟和消息吞吐量。 Scaling out could help, etc.向外扩展可能会有所帮助,等等。

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

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