简体   繁体   English

具有 Azure Function App 的一个 App Service Plan 实例是否一次只处理一条消息 session?

[英]Does one App Service Plan instance with an Azure Function App process only one message session at a time?

I was reading this article about one Azure Function App instance will only process one message session at a time.我正在阅读这篇关于一个 Azure Function 应用程序实例一次只会处理一条消息 session 的文章。 So if we look at an App Service Plan with an Azure function app, that still represents one instance.因此,如果我们查看带有 Azure function 应用程序的应用程序服务计划,它仍然代表一个实例。 If that is the case, if we had three different message sessions, we need to scale out three app service plan to create three instance of that azure function app to process those message sessions.如果是这样的话,如果我们有三个不同的消息会话,我们需要扩展三个应用程序服务计划来创建 azure function 应用程序的三个实例来处理这些消息会话。

在此处输入图像描述

But my assumption may not be correct.但我的假设可能不正确。 When I talk to my coworker, we set our App Service plan's auto-scale to scale out only one instance manually.当我与我的同事交谈时,我们将应用服务计划的自动缩放设置为仅手动扩展一个实例。 It's strange cause we see the different message session data are processed in parallel with that one App Service Plan instance based on the sync timestamp.这很奇怪,因为我们看到不同的消息 session 数据是根据同步时间戳与那个 App Service Plan 实例并行处理的。 How is this possible?这怎么可能? Maybe a single instance of an App Service Plan can have multiple instances of its app?也许应用服务计划的单个实例可以拥有其应用程序的多个实例?

在此处输入图像描述

I got lots of my reading from this the message session documentation and dev.to article我从这条消息 session 文档和 dev.to 文章中得到了很多阅读

https://learn.microsoft.com/en-us/azure/service-bus-messaging/message-sessions https://learn.microsoft.com/en-us/azure/service-bus-messaging/message-sessions

https://dev.to/azure/ordered-queue-processing-in-azure-functions-4h6c https://dev.to/azure/ordered-queue-processing-in-azure-functions-4h6c

在此处输入图像描述

A single compute instance (function in your case) can handle more than a single session. By default, the concurrency on sessions (the number of sessions that can be handled simultaneously) is set to 8. The order is preserved within each session though, so messages per session are delivered in the right order.单个计算实例(在您的情况下为函数)可以处理多个 session。默认情况下,会话的并发性(可以同时处理的会话数)设置为 8。顺序保留在每个session中,但是,因此每个 session 的消息都以正确的顺序传递。 Your code has to handle the fact that the same code is invoked for different sessions and handle it accordingly.您的代码必须处理这样一个事实,即为不同的会话调用相同的代码并相应地处理它。 If the code cannot do that, it has to handle sessions serially, reducing the number of concurrent sessions to 1 by changing the default in host.json .如果代码不能做到这一点,它必须连续处理会话,通过更改host.json中的默认值将并发会话数减少到 1。

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

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