0

I'm designing an application using Azure Storage Blobs/Table/Queue, handling massive amount of data. One important aspect of the application, is that work will be done if a given key don't exist, and determining the existence of a key is a frequent and intensive task.

I need to optimize as much possible billable transactions from existence checks of keys. It could be either against blobs or tables.

I looked at this document Understanding Windows Azure Storage Billing – Bandwidth, Transactions, and Capacity It seems that 404 errors are not counted only from anonymous requests.

I was also thinking of using a BatchTableOperation to check 100 keys at once, maybe using a Replace or Merge, and determine in the results if the key indeed existed (haven't tried, actualy I got the idea while writing)

Any good hack are welcomed.

4

1 回答 1

0

您应该使用Windows Azure 缓存

  • 加载缓存中的所有现有密钥
  • 每次将记录添加到表存储时,也将其添加到缓存中

完成此操作后,请先让您的应用程序检查缓存。如果该项目不存在,请检查表存储以确保(以涵盖边缘情况)。但是在 99% 的情况下,如果项目已经被处理,则密钥将在缓存中可用,并且您不需要查询表存储(这将大大减少表存储的事务)。

如果不能使用 Windows Azure 缓存,还有其他选择,例如使用MemoryCache,将所有键保存在文件中,...

于 2013-01-20T02:12:18.700 回答