Estimating Azure DocumentDB Throughput Needs

Estimating Azure DocumentDB throughput needs

When you want to create a collection in your Azure DocumentDB database account, you have to estimate and specify the throughput size and Azure DocumentDB reserves resources to satisfy your application throughput’s needs. You have to pay for the reserved resources allocated to your collection regardless of usage and the is why it’s important to estimate the throughput size correctly to reduce the operation costs.

What is the throughput measure unit?
Request Unit (RU) per second is the unit of throughput measurement. Azure reserves specified amount of RU/S as your collection throughput. A single request unit represents the processing capacity required to read a single 1KB document. Depends on your document, other requests such as create, update and delete consume more request units.

Specifying throughput size
You have to specify throughput size when you want to create a collection

How to measure throughput size ?
As a first step it’s always good to start with default throughout size. and then start monitoring and measuring consumed request units for common operations and adjust the throughput size. When you query against a collection, Azure returns request charge value in portal or through x-ms-request-charge response header in code. Therefore, you can get some ideas about cost of  your queries.

Azure portal returns request charge
You can see the request charge in Azure portal

Many factors are involved in request unit measurement. Things like number of document properties, indexes, document size and data consistency. Therefore, RU cost differs from application to another application. When you have an idea about your application queries costs and estimated number of requests per second you can estimate how much throughput you need to satisfy your application needs.

Set Alarms
One of the best methods to monitor your service performance and consumed RUs is to set alarms. You can define as many types of alarm as you want to make sure reserved throughput is enough but not more than enough. As a case in point, you can monitor throttled requests number to make sure enough resources has been allocated or check consumed request units to make sure your are not allocating more than enough. If you are keep getting notifications about not consuming expected RUs then it’s time to scale down.

Setting alarms
Administrator is being notified when consumed RUs is less than expected

Leave a Reply

Your email address will not be published. Required fields are marked *