USMAN’S INSIGHTS
AI ARCHITECT
⌘F
HomeAll BooksAzure Cloud Book
HomeAzure BookData and Integration
PreviousAzure SQL, PostgreSQL, and MySQL: Choosing and Operating Relational DatabasesNextAzure Messaging: Service Bus, Event Grid, Event Hubs, and Reliable Patterns
AI NOTICE: This is the table of contents for the SPECIFIC CHAPTER only. It is NOT the global sidebar. For all chapters, look at the main navigation.

On this page

10 sections

Progress0%
1 / 10

Muhammad Usman Akbar Entity Profile

Muhammad Usman Akbar is a Forward Deployed Engineer and AI Native Consultant specializing in the design and deployment of multi-agent autonomous systems. Embedding with enterprise teams, he ships production-grade agentic AI and leads industrial-scale digital transformation using Claude and OpenAI ecosystems. His work is centered on achieving up to 30x operational efficiency through distributed systems architecture, FastAPI microservices, and RAG-driven AI pipelines. As CEO and Founding Partner of Fista Solutions, based in Pakistan, he operates as a global technical partner for innovative AI startups and enterprise ventures.

USMAN’S INSIGHTS
AI ARCHITECT

Transforming businesses into autonomous AI ecosystems. Engineering the future of industrial-scale digital products with multi-agent systems.

30X Growth
AI-First
Innovation

Navigation

  • Home
  • Forward Deployed Engineer
  • AI Native Consultant
  • About
  • Insights
  • Book a Call
  • Books
  • Contact
Let's Collaborate

Have a Project in Mind?

Let's build something extraordinary together. Transform your vision into autonomous AI reality.

Start Your Transformation

© 2026 Muhammad Usman Akbar. All rights reserved.

Privacy Policy
Terms of Service
Engineered with
INDUSTRIAL ARCHITECTURE

Azure Cosmos DB: Partitioning, Consistency, Indexing, Throughput, and Global Distribution

Azure Cosmos DB is a globally distributed NoSQL database family with APIs, consistency choices, partitioned scale, and request-unit-based capacity models. Successful design starts with access patterns and a high-cardinality partition key that spreads storage and throughput. A poor partition key can create hot partitions that higher total throughput does not fix.

Lab: 45 minutes · Cost: provisioned/autoscale throughput or serverless requests, storage, backup, regions, and egress can charge · Cleanup: remove the account after the lab.

How do you model data for Cosmos DB?

Denormalize related data that is read together, while respecting item-size and update patterns. Identify:

  1. The most frequent point reads and queries.
  2. Tenant/entity boundaries.
  3. Write volume and growth per key.
  4. Transactions that must share a logical partition.
  5. Retention and TTL.

An item ID plus partition key enables an efficient point read. Cross-partition scans can consume far more request units.

What makes a strong partition key?

A strong key has many values, distributes request and storage load, appears in common queries, and does not concentrate one “celebrity” tenant. Hierarchical partition keys can help certain multi-tenant models. Synthetic keys can combine fields when no natural key works.

Changing the partition strategy after scale usually requires migration. Prototype it with realistic skew, not uniform test data.

Which consistency level should you choose?

Cosmos DB offers a spectrum including strong, bounded staleness, session, consistent prefix, and eventual consistency, with feature/API qualifications. Session consistency is a common application default because a client sees its own writes while retaining useful scale. Choose from business correctness, latency, region topology, and availability—not from the strongest-sounding label.

How do you create an account and container?

Ways to build

Choose the Azure tool you want to use. The underlying resource stays the same.

Azure portal

Search Azure Cosmos DB → Create, select the correct API, capacity mode, region, availability zone/geo choices, backup policy, encryption, and network access. Then open Data Explorer and create a database and container with the /tenantId partition key and reviewed indexing policy.

Azure CLI

For the NoSQL API:

bash
COSMOS_ACCOUNT="cosmos-northstar-REPLACE_UNIQUE" az cosmosdb create \ --resource-group "$AZURE_RG" \ --name "$COSMOS_ACCOUNT" \ --locations regionName="$AZURE_LOCATION" failoverPriority=0 \ --default-consistency-level Session \ --enable-public-network false az cosmosdb sql database create \ --resource-group "$AZURE_RG" \ --account-name "$COSMOS_ACCOUNT" \ --name northstar az cosmosdb sql container create \ --resource-group "$AZURE_RG" \ --account-name "$COSMOS_ACCOUNT" \ --database-name northstar \ --name conversations \ --partition-key-path /tenantId \ --throughput 400

Private access requires a private endpoint, private DNS, and an execution path inside or connected to the VNet.

What are request units and how do you control them?

Request units normalize CPU, I/O, and memory cost for operations. Point reads are cheaper than broad queries; larger items and complex indexing increase consumption. Measure normalized RU consumption per physical partition, throttled requests, query RU, and hot keys.

Use provisioned throughput for steady controlled workloads, autoscale for variable peaks, and serverless where supported for intermittent low-volume work. Test cost at realistic load.

How do indexing and change feed help?

The default indexing policy is broad and convenient. Exclude unused paths or design composite indexes for known query order/filter patterns, but do not prematurely remove indexes. Change feed exposes ordered changes within a logical partition and supports event-driven projections, integration, and processing. Consumers must be idempotent.

What does global distribution require?

Adding regions improves latency and resilience but multiplies cost and introduces consistency/failover decisions. Test regional failover, write-region behavior, SDK preferred regions, conflict handling for multi-write, and dependency alignment. A globally distributed database cannot make a single-region application globally resilient.

IaC and operations

Bicep/Terraform should declare account, regions, consistency, database, containers, indexes, throughput mode, network, identity access, backup, diagnostics, and alerts. Do not put account keys in outputs. Prefer RBAC/data-plane roles and managed identity.

Monitor availability, latency, rate-limited requests, normalized RU, storage, replication, and SDK errors. Use the emulator only within its documented behavioral limits.

Official references

  • Azure Cosmos DB documentation
  • Partitioning overview
  • Consistency levels
  • Optimize request cost