Skip to main content
Menu

Cosmos DB Throughput Buckets: Migrate Without Throttling

, CEO, Adiom, Inc.5 min read

  • cosmos-db
  • azure
  • migration
  • throughput
  • dynamodb
Cosmos DB Throughput Buckets: Migrate Without Throttling, with the logos of Azure Cosmos DB, Microsoft Azure and Amazon DynamoDB

A migration into an Azure Cosmos DB container that already serves your app competes with that app for request units (RUs). To keep a Dsync migration from throttling production traffic, raise the container’s RU/s, turn down Dsync’s parallelism, and set a write rate limit, in that order. Cosmos DB throughput buckets, now generally available for the API for NoSQL, are a fourth control: a cap the database itself enforces, for cases such as several migration or replication jobs writing to the same account at once.

What are throughput buckets in Azure Cosmos DB?

A throughput bucket caps the requests assigned to it at a percentage of a container’s total throughput. Microsoft announced general availability for Azure Cosmos DB for NoSQL on November 17, 2026, after announcing a public preview on May 22, 2025.

Cosmos DB enforces the cap across all the clients that use the bucket, so ten copy workers share one limit. Requests over the cap get an HTTP 429. A container can have up to five buckets, with IDs 1 to 5.

Two rules from the documentation and FAQ matter for a migration:

  • A bucket is a ceiling and reserves nothing. Capping the migration at 25% doesn’t guarantee the app the other 75%, because other uncapped workloads can still use it.
  • Serverless accounts and containers in a shared throughput database are not supported.

How do you keep a migration from throttling a live Cosmos DB container?

Use four controls, in this order. You can combine them.

Order Control What it protects When to use it
1 More RU/s The app and the migration, by adding capacity for both When the copy doesn’t fit in the headroom the app leaves at its peak
2 --load-level, or the number of workers in Dsync Enterprise The app, by keeping fewer reads and writes in flight On every run; start low
3 --write-rate-limit The app, by capping writes per second before they leave Dsync When you want a known ceiling on the migration
4 Throughput bucket The container, with one cap that Cosmos DB enforces for every client in the bucket When several jobs write to the same containers

1. Raise RU/s before the copy

More RU/s is the only control that adds capacity. The other three take capacity away from the migration, and a slower copy can run out of time. In a DynamoDB to Cosmos DB migration, DynamoDB Streams keep 24 hours of changes. Dsync applies the stream after the copy, so if the copy runs past that window, writes made early on expire before they are applied.

Measure the app’s peak RU/s on the container and compare the headroom with what the copy needs. If it doesn’t fit, raise the RU/s ahead of time: going beyond 10,000 RU/s per physical partition triggers partition splits, which typically take 4 to 6 hours, and they should finish before the copy starts.

2. Limit Dsync’s parallelism with --load-level

--load-level sets how many copy tasks Dsync runs at once. Low, Medium, High and Beast run 4, 8, 16 and 32, with half as many writers on the destination. Without the flag Dsync runs 4 of each, so Low is the lighter choice next to a live app.

In Dsync Enterprise, copy tasks are spread across workers, and the number of workers sets the load.

Parallelism limits how much runs at once. It doesn’t fix a rate, which is what the next flag is for.

3. Add --write-rate-limit for certainty

--write-rate-limit is an overall limit per second on writes to the destination, during both the copy and the change stream. A request that is never sent can’t be throttled, so pacing in Dsync means fewer retries and a predictable copy time.

The limit counts documents and change events, so divide your RU budget by the RU charge per write. Microsoft’s ingestion example estimates 10 RUs per write for 1 KB documents. Replace that with the charge you measure on your own documents and indexing.

Set the limit higher than the largest batch Dsync writes. During the copy a batch is one source page, and a DynamoDB scan page holds up to 1 MB of items.

4. When do you need a throughput bucket?

Add a bucket when you want the database to enforce the ceiling. With one job and a sensible rate limit, a bucket rarely has anything to do. When several jobs write to the same containers, it keeps one ceiling per container for all of them, whatever each job is set to.

A bucket’s cap is a percentage, so raising the RU/s raises the migration’s allowance. A rate limit in Dsync doesn’t move with it.

How do you run Dsync against a dedicated throughput bucket?

We recommend running Dsync against a bucket provisioned for the migration, not the container’s default bucket. The default catches every request that has no bucket assigned, including your app’s.

To create the bucket, open Data Explorer in the Azure portal, select the container, then Scale & Settings, then Throughput Buckets. Activate a bucket and set its percentage a little above what the rate limit should use. Data Explorer uses bucket 1 when it is configured, so pick another.

Cosmos DB for NoSQL is a Dsync source and target through the open source Java connector. The connector has no bucket setting, but the change is one file. In java/src/main/java/adiom/Main.java, in getNsHelper, add these lines after the one that sets helper.asyncContainer:

String bucket = System.getenv("COSMOS_THROUGHPUT_BUCKET");
if (bucket != null) {
    com.azure.cosmos.ThroughputControlGroupConfig group = new com.azure.cosmos.ThroughputControlGroupConfigBuilder()
            .groupName("dsync").throughputBucket(Integer.parseInt(bucket)).defaultControlGroup(true).build();
    helper.container.enableServerThroughputControlGroup(group);
    helper.asyncContainer.enableServerThroughputControlGroup(group);
}

This follows Microsoft’s Java sample and needs Java SDK 4.83.0 or later, the minimum version for buckets.

Build with JDK 21 or later, start the connector with the bucket ID, and point Dsync at it. $URL and $KEY are the account endpoint and key:

git clone https://github.com/adiom-data/dsync.git
cd dsync/java
# edit src/main/java/adiom/Main.java as above
mvn clean install
COSMOS_THROUGHPUT_BUCKET=2 OTEL_SDK_DISABLED=true \
  java -jar target/cosmos-connector-1-jar-with-dependencies.jar 8089 "$URL" "$KEY" &
dsync --load-level Low --write-rate-limit 3000 \
  --namespace "orders:shop.orders" dynamodb grpc://localhost:8089 --insecure

What should you check before the full copy?

Run a small slice first, with the app under normal load. Watch Total Request Units (preview), split by ThroughputBucket, along with the app’s latency and 429 count.

Keep the rate limit below the bucket’s cap, and leave both limits on through the change stream phase.

After cutover, stop the migration before you delete the bucket. Deleting a bucket removes its limit without any error, and requests that still carry its ID draw on the whole container.

Next steps

Setup for the full flow is in the DynamoDB to Cosmos DB quickstart, and our DynamoDB to Cosmos DB page covers the wider plan. If you need help fitting a copy into your RU budget, talk to an engineer.

Moving a production database?

Talk to the engineers who build Dsync. We’ll tell you what the migration actually involves, including when the answer is that you don’t need us.