gpt4 book ai didi

c# - 对 Azure 队列调用 CreateIfNotExistsAsync() 的性能影响

转载 作者:太空狗 更新时间:2023-10-30 01:00:37 24 4
gpt4 key购买 nike

我应该在 Azure 队列上的每次读/写之前调用 CreateIfNotExistsAsync() 吗?

我知道它会导致 REST 调用,但它会在队列上执行任何 IO 操作吗?

我正在使用 Azure 队列的 .Net 库(如果此信息很重要)。

最佳答案

该方法所做的就是尝试创建队列并捕获 AlreadyExists 错误,您可以通过在尝试访问队列时捕获 404 错误来轻松复制该错误。肯定会对性能产生一些影响。

更重要的是,它会增加您的成本:来自 Understanding Windows Azure Storage Billing – Bandwidth, Transactions, and Capacity [MSDN] 的存档

We have seen applications that perform a CreateIfNotExist [sic] on a Queue before every put message into that queue. This results in two separate requests to the storage system for every message they want to enqueue, with the create queue failing. Make sure you only create your Blob Containers, Tables and Queues at the start of their lifetime to avoid these extra transaction costs.

关于c# - 对 Azure 队列调用 CreateIfNotExistsAsync() 的性能影响,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44528304/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com