Azure Cosmos DB

Abstract

  • A multi-model, schema-free, fully schema agnostic database. multi model
  • A globally distributed database designed for scalable, broadly distributed, highly responsive and highly available applications.
  • Superset data service of DocumentDB. Earlier, Microsoft offered DocumentDB as Data as a Service (DaaS), which supported a limited set of features and functionalities. Microsoft’s engineers shared their challenges, running the company’s cloud-based services, such as Bing, Azure and Office 365 using DocumentDB. Microsoft understood their engineer’s challenges and marketed the opportunity to take DocumentDB to the next level. Being geo-distributed across Azure regions/data centers it’s already available in all of them, and will be automatically available in new regions as they come online, because it’s a foundational service for Microsoft’s own properties. Configuring geo-distribution is as simple as clicking on a map to add or drop regions, while the application continues to run. Microsoft aptly calls this feature “global distribution turnkey
  • Azure Cosmos DB also supports several NoSQL APIs including DocumentDB SQL, MongoDB, Apache Gremlin, and Azure Tables/Table Storage.
  • Can handle a variety of data to store (all four NoSql models), key-value, document, columnar, and graph types. This database engine is based on the atom-record-sequence (ARS) data model.
  • ?? Cosmos DB provides a method to the user to distinguish between transactions with high latency vs. a database being unavailable ??
  • Azure Cosmos DB engine is designed to manage elastically scaled throughput, based on the application traffic patterns across different geographical regions, to support fluctuating workloads varying both by geography and time.
  • MS advertises guaranteed single-digit millisecond latency, SLAs for latency at the 99th percentile, together with five well-defined consistency levels: strong, bounded staleness, session, consistent-prefix and eventual. different consistency models
  • It’s optimized for low-latency database reads and writes. It does this through the use of Solid State Disk storage and with “latchless” and “lockless” data structures which, interestingly, bear some resemblance to those used by SQL Server’s In-Memory OLTP model, as well.
  • DocumentDB can determine the schema and index data as documents are inserted, and lets you query against that index. This is possible due to DocumentDB’s deep commitment to the JSON data model. Cosmos DB indexes every column by default.
  • Cosmos DB supports relational, hierarchical, and spatial querying of JSON documents using SQL without specifying a schema or secondary indexes, JavaScript user defined functions (UDFs), JavaScript operators, and a multitude of built-in functions. The SQL type system, expression evaluation, function invocation (UDFs), and other aspects of DocumentDB mirror that of JavaScript. DocumentDB is a JSON document database capable of executing JavaScript directly in the database engine, using JavaScript’s programming model as the foundation for the query language.

Azure Cosmos DB Emulator

Connect to the Azure Cosmos DB Emulator running locally

DocumentClient client = new DocumentClient(new Uri("https://localhost:8081"), "C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==");

auto-generated fields

{
    "id": "a1081e6b-a52b-4601-b352-d3e22722d7e1",
    "_rid": "kZZ3AN3KKwABAAAAAAAAAA==",
    "_self": "dbs/kZZ3AA==/colls/kZZ3AN3KKwA=/docs/kZZ3AN3KKwABAAAAAAAAAA==/",
    "_etag": "\"00000800-0000-0000-0000-59c4e62a0000\"",
    "_attachments": "attachments/",
    "_ts": 1506076202
}

Event-driven architectures with Change Feed Processor library

Build event-driven architectures and receive a real-time stream of database updates with Azure Cosmos DB change feed. Change feed enables reactive programming models for Internet of Things (IoT) telemetry and e-commerce ordering pipelines. Reading change feed across multiple partitions is easy with the Change Feed Processor library now available as a NuGet package for .NET development. This library facilitates distributing change feed event processing across multiple consumers. It also provides a thread-safe, multi-process, safe runtime environment with checkpoint and partition lease management for large-scale distributed event processing applications.

Event-driven architectures with Change Feed Processor library