Azure Cosmos DB: A Scalable, Globally Distributed NoSQL Database

 

What is Azure Cosmos DB?

Azure Cosmos DB is a fully managed NoSQL, relational, and vector database that delivers single-digit millisecond response times, automatic scalability, and guaranteed performance at any scale.

What is NoSQL?

NoSQL databases are flexible, scalable databases that handle various data formats like documents or key-value pairs, unlike traditional SQL databases with fixed schemas.

Key Features:

  • Global Distribution: Available in 54+ regions with seamless multi-region distribution.
  • High Availability: 99.999% uptime for reads and writes.
  • Elastic Scalability: Scale effortlessly from thousands to millions of requests per second.
  • Low Latency: Sub-10ms response times for reads and writes.
  • Flexible Consistency: Multiple consistency levels to suit your needs.
  • Schema-Agnostic: No schema management required for dynamic data.
  • Concept related to Cosmos DB:

    Data Format: Data sent to Azure Cosmos DB via Dapr (a distributed application runtime) must be in JSON-serialized format, emphasizing the importance of JSON for Cosmos DB's NoSQL API.

    Database: Each account can contain one or more Databases. A database is a logical unit of management for containers in Azure Cosmos DB for NoSQL.

    Containers: Containers are the core units of scalability in Cosmos DB, where the provision throughput and settings are managed like indexing and time-to-live (TTL) policies.

    Items: It refers to the documents stored within containers in JSON format. Cosmos DB supports these JSON documents natively and ensures atomicity in write operations.

    Partition Keys: Every container requires a partition key, which Cosmos DB uses to logically partition data for scalability and performance.

    Partitioning and Horizontal Scaling: Azure Cosmos DB scales using partitioning, which divides data into logical partitions based on a partition key. For example, if UserID is the partition key, items with different UserID values are grouped into separate logical partitions. These logical partitions are then distributed across physical partitions, which manage the actual data and throughput.

    Indexing in Azure Cosmos DB: Cosmos DB automatically indexes all properties of items without requiring schema management. It also can customize indexing policies to include or exclude specific paths.

    Azure Cognitive Search: Azure Cognitive Search is designed to work with both structured and unstructured data. It supports indexing and searching over a wide variety of data types.

    For more in-depth details, please explore the Azure Cosmos DB Page.

    What is SQL?

    Azure SQL Database is a fully managed relational database service that offers high availability, security, and performance. Includes built-in intelligence, advanced security, automatic backups, and scaling capabilities.

    Use Cases and Applications:

    When to Use SQL

  • Structured Data: Best for applications with well-defined schema and relationships.
  • Complex Queries: Suitable for scenarios involving complex joins, aggregations, and transactions.
  • Regulatory Compliance: Offers built-in features for role-based access control, auditing, and encryption.

  • When to Use CosmosDB:

  • Unstructured Data: Ideal for applications with flexible or semi-structured data requirements.
  • Global Distribution: Supports low-latency, high-throughput access across multiple regions.
  • High Scalability: Automatically scales to handle large volumes of reads and writes.
  •  

    Comparison:

    Type of Database: 

    •  SQL: Relational database, supports ACID transactions.
    • Cosmos DB: NoSQL database, supports multiple data models (document, key-value, graph).

    Scalability:

    • SQL: Scales vertically with more compute power.
    • Cosmos DB: Scales horizontally with partitioning and global distribution.

    Availability:

    • SQL: 99.995% for SQL Database, 99.99% for Managed Instances.
    • Cosmos DB: 99.99% for single-region, 99.999% for multi-region setups.

    Pricing:

    • SQL: The resources are billed hourly at at fixed rate based on the services tier.
    • Cosmos DB: The cost of all database operations is normalized and expressed as request units.


    Comments

    Popular posts from this blog

    Introduction to Copilot in PowerApps

    Still using Classic SharePoint Sites?

    SharePoint Migration