MSDN Documentation

Introduction to Azure Cosmos DB

Azure Cosmos DB is a globally distributed, multi-model database service. It offers turnkey global distribution, massive read and write throughput, and low latency access to data anywhere in the world. Cosmos DB is designed for modern cloud applications that require high availability, scalability, and performance.

What is Azure Cosmos DB?

Azure Cosmos DB is Microsoft's globally distributed, multi-model database service. It's the first cloud-native NoSQL database service and is designed to be a highly available, mission-critical database that can handle anywhere from a few requests per second to hundreds of millions of requests per day. Cosmos DB supports multiple data models, including document, key-value, graph, and column-family.

Key Features and Benefits

  • Turnkey Global Distribution: Distribute data across any number of Azure regions with a single API call.
  • Guaranteed High Availability: Offers 99.999% availability for multi-region configurations.
  • Elastic Scalability: Independently and elastically scale throughput and storage.
  • Guaranteed Low Latency: Single-digit millisecond read and write latencies at the 99th percentile.
  • Multiple Data Models: Supports document, key-value, graph, and column-family data with open-source APIs.
  • Multi-API Support: Offers APIs for SQL (Core API), MongoDB, Cassandra, Gremlin, and Table.
  • Cost-Effectiveness: Pay only for what you provision, with various pricing tiers available.

Core Concepts

Understanding the core concepts of Cosmos DB is crucial for effective usage:

  • Accounts: A Cosmos DB account is the top-level resource. It can contain multiple databases.
  • Databases: A database is a logical namespace that contains containers and other child resources.
  • Containers: Containers are the fundamental units of scalability for both storage and throughput. Data is stored in containers.
  • Items: Items are the individual entities stored within a container. For document databases, items are JSON documents.
  • Partitions: Containers are further divided into logical partitions, which are physical storage constructs. A partition key is used to determine which logical partition an item belongs to.
  • Throughput: Measured in Request Units per second (RU/s). You can provision throughput at the container or database level.

Use Cases

Azure Cosmos DB is ideal for a wide range of applications, including:

  • Internet of Things (IoT): Ingesting and processing massive amounts of telemetry data.
  • Gaming: Storing player data, game state, and leaderboards with low latency.
  • Web and Mobile Applications: Powering personalized user experiences, content management, and shopping carts.
  • E-commerce: Managing product catalogs, orders, and customer profiles.
  • Recommendation Engines: Storing and querying relationships for personalized recommendations.

Getting Started

To start with Azure Cosmos DB, you can:

  1. Create an Azure Account: If you don't have one, sign up for a free Azure account.
  2. Create an Azure Cosmos DB Account: Use the Azure portal to create your first Cosmos DB account.
  3. Choose an API: Select the API that best suits your application needs (e.g., SQL API for document-centric data).
  4. Create a Database and Container: Set up your data structure.
  5. Migrate or Add Data: Start populating your database.

This introduction provides a foundational understanding of Azure Cosmos DB. The following sections will delve deeper into specific APIs, architectural considerations, and best practices.

Next Steps: