title: Slow performance on Azure DocumentDB
body: <p>I'm currently facing quite slow response times from Azure DocumentDB (first time trying it).</p>
  
  <p>There are 31 objects in a collection, which I am going to fetch and return to the caller. The code I am using is this:</p>
  
  <pre><code>public async Task&lt;List&lt;dynamic&gt;&gt; Get(string collectionName = null)
  {
      // Lookup from Dictionary, takes literally no time
      var collection = await GetCollectionAsync(collectionName);
  
      var sw = Stopwatch.StartNew();
  
      var query = await
          _client.CreateDocumentQuery(collection.DocumentsLink, 
              new FeedOptions { MaxItemCount = 1000 })
              .AsDocumentQuery()
              .ExecuteNextAsync();
  
      Trace.WriteLine($"Get documents: {sw.ElapsedMilliseconds} ms");
  
      return query.ToList();
  }
  </code></pre>
  
  <p>To instantiate the client, I'm using the following code:</p>
  
  <pre><code>_client = new DocumentClient(new Uri(endpoint), authKey, new ConnectionPolicy
  {
      ConnectionMode = ConnectionMode.Direct,
      ConnectionProtocol = Protocol.Tcp
  });
  </code></pre>
  
  <p>The response times I am getting from the <code>Stopwatch</code> is between 360ms and 1200ms to return 31 objects. For me, that is <em>quite</em> slow. Without the custom <code>ConnectionPolicy</code>  the average response time is ca 950ms.</p>
  
  <p>Am I doing something wrong here? Is it possible to speed these requests up somehow?</p>
  
  <p>Here is the output from the Trace, printing out the Stopwatch's elapsed time:</p>
  
  <pre><code>Get documents: 1984 ms
  Get documents: 1252 ms
  Get documents: 1246 ms
  Get documents: 359 ms
  Get documents: 356 ms
  Get documents: 356 ms
  Get documents: 351 ms
  Get documents: 1248 ms
  Get documents: 1314 ms
  Get documents: 1250 ms
  </code></pre>