在Azure Function应用中限制Azure存储队列处理 [英] Throttling Azure Storage Queue processing in Azure Function App
问题描述
我已经创建了一个带有Azure存储队列触发器的Azure Function应用程序,该触发器处理一个队列,其中每个队列项都是一个URL.该功能仅下载URL的内容.我还有另一个功能,可以加载和解析站点的XML Sitemap并将所有页面URL添加到队列中.我的问题是功能"应用程序运行太快,会锤击网站,因此开始返回服务器错误".有没有一种方法可以限制/限制功能"应用的运行速度?
我当然可以编写一个简单的Web作业,以串行方式处理它们(或进行一些异步操作,但限制并发请求的数量),但是我真的很喜欢Azure Functions的简单性,并想尝试无服务器"计算
您可以考虑以下几种选择.
首先,您可以在 There are a few options you can consider. First, there are some knobs that you can configure in Another option might be for you to set the NextVisibleTime on the messages you enqueue in such a way that they are spaced out - by default messages that are enqueued become visible and ready for processing immediately. A final option might be be for you to enqueue a message with the collection of all URLs for a site, rather than one at a time, so when the message is processed, you can process the URLs serially in your function, and limit the parallelism that way. 这篇关于在Azure Function应用中限制Azure存储队列处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!host.json
中配置一些控制队列处理的旋钮(记录在host.json
that control queue processing (documented here). The queues.batchSize
knob is how many queue messages are fetched at a time. If set to 1, the runtime would fetch 1 message at a time, and only fetch the next when processing for that message is complete. This could give you some level of serialization on a single instance.