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

标签 c# .net azure azure-queues

我应该在 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/

相关文章:

c# - 对 cybersource 的无效交易尝试给出错误

c# - 如何从 .NET 中的 X509 证书中提取电子邮件?

.net - 如何将 ContextMenuStrip 附加到 NotifyIcon

azure - 找不到测试文件时如何使 AzureDevops 管道失败

mobile - 从命令行使用 Azure 移动服务进行测试

c# - 如何在任何用户计算机上找到桌面?

c# - 依赖注入(inject)在 Azure 功能中失败,一旦部署,但在本地工作

c# - Win2D 梯形校正

.net - Docker 文件当前工作 > 目录不包含项目或解决方案文件

node.js - 使用 node.js 发布到 Neo4j 服务器