使用Azure函数在批处理中运行记录循环
我是Azure的新手。我需要为每条记录触发一个azure函数。我可以在一个循环中完成,但这会变成一个连续的过程,需要时间,并导致超时。相反,我希望它在并行处理模式下完成 到目前为止,我的方法是使用Azure函数在批处理中运行记录循环,azure,azure-functions,azure-queues,Azure,Azure Functions,Azure Queues,我是Azure的新手。我需要为每条记录触发一个azure函数。我可以在一个循环中完成,但这会变成一个连续的过程,需要时间,并导致超时。相反,我希望它在并行处理模式下完成 到目前为止,我的方法是 创建一个队列,并将每个记录从数据库推送到队列中 根据添加到队列的消息触发函数 这个设置很好,但我觉得将记录插入队列本身就是一个连续的过程。有没有其他方法可以做到这一点。请提供帮助因为要为每条记录触发函数,队列存储触发器是一个不错的选择。您可以在两个方面改进您的方法 Azure功能部分 您可以在host.j
这个设置很好,但我觉得将记录插入队列本身就是一个连续的过程。有没有其他方法可以做到这一点。请提供帮助因为要为每条记录触发函数,队列存储触发器是一个不错的选择。您可以在两个方面改进您的方法 Azure功能部分 您可以在host.json中配置以控制队列处理。
queues.batchSize
旋钮是一次获取队列消息的数量
"queues": {
// The maximum interval in milliseconds between
// queue polls. The default is 1 minute.
"maxPollingInterval": 2000,
// The visibility timeout that will be applied to messages that fail processing
// (i.e. the time interval between retries). The default is zero.
"visibilityTimeout" : "00:00:30",
// The number of queue messages to retrieve and process in
// parallel (per job function). The default is 16 and the maximum is 32.
"batchSize": 16,
// The number of times to try processing a message before
// moving it to the poison queue. The default is 5.
"maxDequeueCount": 5,
// The threshold at which a new batch of messages will be fetched.
// The default is batchSize/2. Increasing this value will increase the
// level of concurrency and therefore throughput. New batches of messages
// will be pulled until the number of messages being processed is greater
// than this threshold. When the number dips below this threshold, new
// batches will be fetched.
"newBatchThreshold": 8
}
参考:
您的代码部分
您可以使用多线程代码将记录插入队列
参考:
你好。谢谢你的建议。这很有帮助。嗨,我在部署这个函数时遇到了另一个问题。以问题的形式发布