在 Azure 队列上调用 CreateIfNotExistsAsync() 的性能影响
Performance impact of calling CreateIfNotExistsAsync() on a Azure queue
我应该在 Azure 队列上的每个 read/write 之前调用 CreateIfNotExistsAsync()
吗?
我知道它会导致 REST 调用,但它会在队列上执行任何 IO 吗?
我正在使用 Azure Queue 的 .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.
我应该在 Azure 队列上的每个 read/write 之前调用 CreateIfNotExistsAsync()
吗?
我知道它会导致 REST 调用,但它会在队列上执行任何 IO 吗?
我正在使用 Azure Queue 的 .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.