Find the request unit charge for operations executed in Azure Cosmos DB for Apache Cassandra
APPLIES TO: Cassandra
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 DB 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 Apache Cassandra. If you are using a different API, see API for MongoDB, API for NoSQL, API for Gremlin, and API for Table articles to find the RU/s charge.
When you perform operations against the Azure Cosmos DB for Apache Cassandra, the RU charge is returned in the incoming payload as a field named RequestCharge
. You have multiple options for retrieving the RU charge.
Use a Cassandra Driver
When you use the .NET SDK, you can retrieve the incoming payload under the Info
property of a RowSet
object:
RowSet rowSet = session.Execute("SELECT table_name FROM system_schema.tables;");
double requestCharge = BitConverter.ToDouble(rowSet.Info.IncomingPayload["RequestCharge"].Reverse().ToArray(), 0);
For more information, see Quickstart: Build a Cassandra app by using the .NET SDK and Azure Cosmos DB.
Next steps
To learn about optimizing your RU consumption, see these articles: