I am launching a series of well-structured queries for Azure Table Storage that should, as far as I can tell, return a minor one. Indeed, if I run them manually (say, from the Azure tools inside Visual Studio), they really return immediately. But when I run them in production, they sometimes get the upper hand for 20-30 seconds to return.
Here is the C # code that I am calling ATS with:
public async Task<IList<T>> FindAsync(string filter, int maxRecords = int.MaxValue, IList<string> columns = null)
{
var returnList = new List<T>();
try
{
Interlocked.Increment(ref _outstandingRequests);
var query = new TableQuery<T>().Where(filter);
if (columns != null && columns.Any())
{
query = query.Select(columns);
}
TableQuerySegment<T> querySegment = null;
var sw = new Stopwatch();
sw.Start();
while (returnList.Count < maxRecords && (querySegment == null || querySegment.ContinuationToken != null))
{
try
{
await 3.RetriesAsync(async x =>
{
querySegment = await
Table.ExecuteQuerySegmentedAsync(query,
querySegment != null ? querySegment.ContinuationToken : null);
});
returnList.AddRange(querySegment);
}
catch (Exception ex)
{
_logger.Error("Error executing ATS query; table:{0}; filter:{1}; error:{2}",
typeof(T).GetFriendlyTypeName(), filter, ex.CompleteMessage());
throw;
}
}
sw.Stop();
if (sw.ElapsedMilliseconds > 10000)
{
var stat = new RepoOperationStats(filter, sw, returnList.Count, _outstandingRequests);
_logger.Warn("Long-running {0} query: secs:{1:0.0}, rc:{2}, or:{3}, fi:{4}",
typeof(T).GetFriendlyTypeName(), stat.Milliseconds / 1000d, stat.ResultCount, stat.OutstandingRequests, stat.Filter);
}
}
finally
{
Interlocked.Decrement(ref _outstandingRequests);
}
return returnList;
}
And here is an example of an object stored in a table:

Everything is pretty simple. But in my logs, I see repeated errors:
AtsOrganizationEventSummaryByCookie: : 33.3, : 0, : 94, fi: (PartitionKey eq '4306.www-detail-mercury-mars-skywatching-tips.html-get') ((RowKey ge '2015.02.05.00000000-0000-0000-0000-000000000000') (RowKey le '2015.02.07.00000000-0000-0000-0000-000000000000 '))
, 33 . , , . ( , .)
- , ? , , 100 . (a) , (b) ATS .
?