Reputation: 617
I have a cosmosDB that had 4 containers and 400RUs provisioned at the database level. I added 2 containers and without warning the provisioned RUs was increased to 600.
The document below explains why this happened. Each container above the 4th requires a minimum extra 100RUs. I have tight budget restrictions so I deleted 2 containers but I could not find a way to reduce the minimum provisioned throughput as the dropdown for provisioning throughput only allows increases. Is there a way to reduce throughput?
https://learn.microsoft.com/en-us/azure/cosmos-db/set-throughput
Upvotes: 2
Views: 885
Reputation: 23782
As mentioned in the document,you could reduce throughput settings by using cosmos db sdk. For example, i test java sdk to reduce my container throughput setting. Please refer to below code:
import com.microsoft.azure.documentdb.*;
import java.util.Iterator;
public class ChangeRUTest {
static private String YOUR_COSMOS_DB_ENDPOINT = "https://***.documents.azure.com:443/";
static private String YOUR_COSMOS_DB_MASTER_KEY="***";
public static void main(String[] args) throws DocumentClientException {
DocumentClient client = new DocumentClient(
YOUR_COSMOS_DB_ENDPOINT,
YOUR_COSMOS_DB_MASTER_KEY,
new ConnectionPolicy(),
ConsistencyLevel.Session);
String collectionLink = "dbs/test/colls/one";
String collectionResourceId = client.readCollection(collectionLink, null).getResource().getResourceId();
// find offer associated with this collection
Iterator<Offer> it = client.queryOffers(
String.format("SELECT * FROM r where r.offerResourceId = '%s'", collectionResourceId), null).getQueryIterator();
Offer offer = it.next();
System.out.println(offer.getContent().getInt("offerThroughput"));
// update the offer
int newThroughput = 400;
offer.getContent().put("offerThroughput", newThroughput);
client.replaceOffer(offer);
}
}
Upvotes: 1