Azure 函数文档数据库 [英] Azure Function & Document DB

查看:18
本文介绍了Azure 函数文档数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很好奇 Azure Functions 上的缩放如何与输出到 Document DB 相关.

基本上,当 Document DB 因为超出分配的吞吐量而返回 429 时会发生什么?我问是因为当我将最低级别的 Azure Functions 与最低级别的 Document DB 相结合并在 20 秒内继续调用该函数 1000 次时,我只看到 700-800 个实际文档插入到我的文档数据库集合中.当我再次将 Document DB 扩展到具有相同最低功能级别的最大值时,我的 doc db 集合中只收到了 700-800 个文档.但是,当我将函数缩放到最大值,文档数据库为最大值时,我得到了全部 1000.当我将文档数据库降到最小值时,我只得到了 300ish....虽然看起来我已经锁定了文档db 帐户,并且它仍在重试插入,直到成功为止.

所以我只是对缩放感到困惑,如果我能获得一些见解,以便更好地调整功能或应用程序的各个方面.

解决方案

是的,它目前在 429 重试,等待 DocDB 响应建议的时间量.目前没有绝对的超时,因此重试将继续,直到它们通过(我现在正在仔细检查这是否是预期的行为).

在您的第一个场景中,如果您等待足够长的时间来移除节流阀,最终是否会全部显示 1000 个?

我想尝试复制这一点——您是否在启用功能之前将 1000 个项目放入队列中?还是以其他方式称呼它?

如果您好奇的话,正在运行的特定重试代码在这里:https://github.com/Azure/azure-webjobs-sdk-extensions/blob/master/src/WebJobs.Extensions.DocumentDB/DocumentDBUtility.cs#L36p>

I'm curious how the scaling working on the Azure Functions with relation to outputting to Document DB.

Basically what happens when Document DB returns a 429 because I'm exceeded my allocated throughput? I ask because when I had the lowest level of Azure Functions combined with the lowest level of Document DB and proceeded to call the function 1000 times in 20 sec I was only seeing 700-800 actual documents inserted into my document db collection. When I scaled Document DB up to the max with the same lowest Function level again I only received 700-800 documents in my doc db collection. However when I scaled the Function up to the max with the document db at the max I get all 1000. When I drop doc db down to the min I only got 300ish....though it does seem like I've locked the doc db account up and that it's still retrying the insert until it can succeed.

So I'm just confused as to this is scaling and if I could get some insight so I could better tune various aspect of the function or app.

解决方案

Yes, it does currently retry on 429, waiting the suggested amount of time as per the DocDB response. There's currently no absolute timeout so the retries will continue until they get through (I'm double-checking right now if this is the expected behavior).

In your first scenario, if you wait long enough for the throttle to be removed, do all 1000 eventually show up?

I'd like to try replicating this -- are you sticking 1000 items in a queue before enabling your function? Or calling it some other way?

The specific retry code that's running is here if you're curious: https://github.com/Azure/azure-webjobs-sdk-extensions/blob/master/src/WebJobs.Extensions.DocumentDB/DocumentDBUtility.cs#L36

这篇关于Azure 函数文档数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆