如何加速Azure存储队列

Jer*_*oyd 4 performance azure azure-storage azure-storage-queues

我已经尝试了一切我能想到的提高插入速度的方法.这实际上只是一些没有改进的事情.

我有一些标识符(Int64)需要发送到队列,以便我的多个工作者角色可以在其上工作,而不必担心并发.

我尝试了一个foreach循环(都带有.ToString()BitConverter.GetBytes()):

foreach(long id in ids) {
    queue.AddMessage(new CloudQueueMessage(id.ToString() /*BitConverter.GetBytes(id)*/));
}
Run Code Online (Sandbox Code Playgroud)

并行.ForAll<T>():

ids.AsParallel().ForAll(id => queue.AddMessage(new CloudMessage(id.ToString())));
Run Code Online (Sandbox Code Playgroud)

无论是本地还是同一数据中心内的WorkerRole,插入最大值为每秒5次,平均每秒4.73次.

难道我做错了什么?

辛普森

Dav*_*gon 14

尝试在tcp堆栈上禁用Nagle,因为这会缓冲小数据包,导致内容传输延迟超过1/2秒.把它放在你的角色开始代码中:

ServicePointManager.UseNagleAlgorithm = false; 
Run Code Online (Sandbox Code Playgroud)

  • 巨大差异,4.73至250(眼球估计)/秒 (3认同)
  • 这篇博文旨在增加大卫的答案:http://blogs.msdn.com/b/windowsazurestorage/archive/2010/06/25/nagle-s-algorithm-is-not-friendly-towards-small-requests.aspx :) (2认同)
  • 你应该看看Sandrino迪马蒂亚的答案在这里:http://stackoverflow.com/questions/12750302/how-to-achive-more-10-inserts-per-second-with-azure-storage-tables/12750535#12750535.他更深入地了解大卫的回应. (2认同)