title: Cosmos Db Graph - Performance and throughput of Gremlin.Net vs Microsoft.Graph
body: <p>As I'm learning how to use graph with Cosmos DB, I found two Microsoft tutorials:</p>
  
  <ul>
  <li><a href="https://docs.microsoft.com/en-us/azure/cosmos-db/create-graph-dotnet" rel="noreferrer">One</a> using <a href="http://tinkerpop.apache.org/docs/3.2.7/reference/#gremlin-DotNet" rel="noreferrer">Gremlin.Net</a></li>
  <li>The <a href="https://docs.microsoft.com/en-us/azure/cosmos-db/tutorial-develop-graph-dotnet" rel="noreferrer">other</a> using <a href="https://www.nuget.org/packages/Microsoft.Azure.Graphs/" rel="noreferrer">Microsoft.Azure.Graph pre-release</a></li>
  </ul>
  
  <p>While I use the same query, its execution differs.<br/><br/>
  Using Gremlin.Net, it executes at once. I very often (I'd say 70% of the time) get a <code>RequestRateTooLargeException</code>. If I understand correctly, it means that I keep reaching the 400RU/s limit that I chose to start with. However, when the query goes trough, it is twice as fast a the solution with Microsoft.Azure.Graph.</p>
  
  <p>Indeed, with Micorosft.Azure.Graph, I have to call <code>ExecuteNextAsync</code> in a loop which returns one result at a time.</p>
  
  <p>So the questions are:<br/>
  1°) Which method should I use for better performance?<br/>
  2°) How can I know the RU of my query so I can fine tune it?<br/>
  3°) Is it possible to increase the throughput of an existing collection?</p>
  
  <p>Update<br/><br/>
  Re question 3, I found that in the "Data Explorer" blade of my database, there is a "Scale &amp; Settings" for my graph where I can update the throughput.<br/><br/></p>
  
  <p>Update2<br/><br/>
  Re question 2, we can't get the RU charged when using the first method (Gremlin.Net) but the Microsoft.Graph the method <code>ExecuteNextAsync</code> returns a <code>FeedResponse</code> with a field <code>RequestCharge</code>.</p>