Events
17 Mar, 9 pm - 21 Mar, 10 am
Join the meetup series to build scalable AI solutions based on real-world use cases with fellow developers and experts.
Register nowThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
APPLIES TO:
Gremlin
Azure Cosmos DB supports many APIs, such as SQL, MongoDB, Cassandra, Gremlin, and Table. Each API has its own set of database operations. These operations range from simple point reads and writes to complex queries. Each database operation consumes system resources based on the complexity of the operation.
The cost of all database operations is normalized by Azure Cosmos DB and is expressed by Request Units (or RUs, for short). Request charge is the request units consumed by all your database operations. You can think of RUs as a performance currency abstracting the system resources such as CPU, IOPS, and memory that are required to perform the database operations supported by Azure Cosmos DB. No matter which API you use to interact with your Azure Cosmos container, costs are always measured by RUs. Whether the database operation is a write, point read, or query, costs are always measured in RUs. To learn more, see the request units and it's considerations article.
This article presents the different ways you can find the request unit (RU) consumption for any operation executed against a container in Azure Cosmos DB for Gremlin. If you are using a different API, see API for MongoDB, Cassandra API, SQL API, and Table API articles to find the RU/s charge.
Headers returned by the Gremlin API are mapped to custom status attributes, which currently are surfaced by the Gremlin .NET and Java SDK. The request charge is available under the x-ms-request-charge
key. When you use the Gremlin API, you have multiple options for finding the RU consumption for an operation against an Azure Cosmos container.
Sign in to the Azure portal.
Create a new Azure Cosmos account and feed it with data, or select an existing account that already contains data.
Go to the Data Explorer pane, and then select the container you want to work on.
Enter a valid query, and then select Execute Gremlin Query.
Select Query Stats to display the actual request charge for the request you executed.
When you use the Gremlin.NET SDK, status attributes are available under the StatusAttributes
property of the ResultSet<>
object:
ResultSet<dynamic> results = client.SubmitAsync<dynamic>("g.V().count()").Result;
double requestCharge = (double)results.StatusAttributes["x-ms-request-charge"];
For more information, see Quickstart: Build a .NET Framework or Core application by using an Azure Cosmos DB for Gremlin account.
When you use the Gremlin Java SDK, you can retrieve status attributes by calling the statusAttributes()
method on the ResultSet
object:
ResultSet results = client.submit("g.V().count()");
Double requestCharge = (Double)results.statusAttributes().get().get("x-ms-request-charge");
For more information, see Quickstart: Create a graph database in Azure Cosmos DB by using the Java SDK.
To learn about optimizing your RU consumption, see these articles:
Events
17 Mar, 9 pm - 21 Mar, 10 am
Join the meetup series to build scalable AI solutions based on real-world use cases with fellow developers and experts.
Register nowTraining
Module
Measure index performance in Azure Cosmos DB for NoSQL - Training
Measure the performance of an indexing policy in Azure Cosmos DB for NoSQL.
Certification
Microsoft Certified: Azure Cosmos DB Developer Specialty - Certifications
Write efficient queries, create indexing policies, manage, and provision resources in the SQL API and SDK with Microsoft Azure Cosmos DB.
Documentation
Request Units as a throughput and performance currency - Azure Cosmos DB
Learn how request units function as a currency in Azure Cosmos DB and how to specify and estimate Request Unit requirements.
Estimate costs using the Azure Cosmos DB capacity planner - API for NoSQL
Learn how to use Azure Cosmos DB capacity planner to estimate the throughput and cost required when using Azure Cosmos DB for NoSQL.
Resource Manager templates for Azure Cosmos DB for Gremlin
Use Azure Resource Manager templates to create and configure Azure Cosmos DB for Gremlin.
Optimizing the cost of your requests in Azure Cosmos DB
This article explains how to optimize costs when issuing requests on Azure Cosmos DB.