Cosmos DB

Azure Cosmos DB
Developer(s) Microsoft
Initial release 2017
Development status Active
Available in English
Type Multi-model database
Website www.cosmosdb.com

Azure Cosmos DB is Microsoft’s globally-distributed, multi-model database service "for managing data at planet-scale" launched in May 2017.[1] It builds upon and extends the earlier Azure DocumentDB, which was released in 2014.[2] It is schema-less and generally classified as a NoSQL database.

Dynamically tunable

With the current recommended option of "partitioned collection" type, DocumentDB is dynamically tunable along three dimensions:

  1. Throughput. Developers reserve throughput of the service according to the application's varying load. Behind the scenes, DocumentDB will scale up resources (memory, processor, partitions, replicas, etc.) to achieve that requested throughput while maintaining the 99.99th percentile of latency for reads to under 10 ms and for writes to under 15 ms. Throughput is specified in request units (RUs) per second. The number of RUs consumed for a particular operation vary based upon a number of factors, but the fetching of a single 1KB document by id spends roughly 1 RU. Delete, update, and insert operations consume roughly 5 RUs assuming 1 KB documents. Big queries and stored procedure executions can consume 100 s or 1000 s of RUs based upon the complexity of the operations needed.[3]
  2. Space. Similarly, Developers can specify how much storage they will need. Both space and throughput directly effect how much the user is charged but either can be tuned up dynamically to handle peak load and down to save costs when more lightly loaded.
  3. Consistency. DocumentDB provides four consistency levels: strong, bounded-staleness, session, and eventual. The further to the left in this list, the greater the consistency but the higher the RU cost which essentially lowers available throughput for the same RU setting. Session level consistency is the default.[4] Even when set to lower consistency level, any arbitrary set of operations can be executed in an ACID-compliant transaction by performing those operations from within a stored procedure. You can also change the consistency level for each request using the x-ms-consistency-level request header or the equivalent option in your SDK.

Partitioning

DocumentDB added automatic partitioning capability in 2016 with the introduction of partitioned collections. Behind the scenes, the collection will span multiple physical partitions with documents distributed by a caller-supplied partition key. DocumentDB automatically decides how many partitions to spread your data across depending upon the size and throughput needs. When DocumentDB decides to add (or remove) partitions, your data remains available while it is rebalanced across the new (or remaining) partitions.

Before partitioned collections were available it was common to write your own code to partition your data and some of the DocumentDB SDKs explicitly supported several different partitioning schemes. That mode is still available but now only recommended when your needs will not exceed the capacity of one collection or when the built-in partitioning capability does not otherwise meet your needs.

Automatic indexing

By default, every field in each document is automatically indexed generally providing good performance without tuning to specific query patterns. These defaults can be modified by setting an indexing policy which can vary per field.

JavaScript

A JavaScript engine is embedded in DocumentDB. This is a perfect fit for JSON documents, but it is also enables additional functionality:

Supported environments

In the following environments all features (except Direct Mode which is currently only supported for .NET) are explicitly supported with dedicated SDKs:

Additionally, DocumentDB can be accessed with the following:

Querying mechanisms

Several mechanisms for querying are provided:

  1. SQL-like query language with adjustments to match JSON data types.
  2. LINQ language integrated queries.
  3. JavaScript language integrated queries. This is only available from the server-side SDK exposed to stored procedures, triggers, and user-defined functions. It is modeled after the Underscore.js API.
  4. MongoDB query language (JSON) via the MongoDB driver-level protocol support.

Other features

Additionally DocumentDB has support for:

Reception

Gartner Research positions Microsoft as the leader in the Magic Quadrant Operational Database Management Systems in 2016[8] and explicitly calls out the unique capabilities of DocumentDB in their writeup.

Real-world use cases

Criticism and cautions

See also

References

  1. "Azure Cosmos DB". Microsoft Azure. Microsoft. Retrieved 9 July 2017.
  2. CrawCour, Ryan (21 August 2014). "Introducing Azure DocumentDB – Microsoft’s fully managed NoSQL document database service". Retrieved 9 July 2017.
  3. syamkmsft. "DocumentDB storage and performance". docs.microsoft.com. Retrieved 2016-12-01.
  4. syamkmsft. "Consistency levels in DocumentDB". docs.microsoft.com. Microsoft. Retrieved 2016-12-01.
  5. Maccherone, Larry. "Announcing documentdb-lumenize". blog.lumenize.com. Retrieved 2016-12-11.
  6. "Using Azure DocumentDB asn ASP.NET Core for extreme NoSQL performance". auth0.com.
  7. kiratp. "Distribute data globally with DocumentDB". docs.microsoft.com. Retrieved 2016-12-11.
  8. "Magic Quadrant for Operational Database Management Systems". www.gartner.com. Retrieved 2016-12-11.
  9. "A Journey to Social". medium.com.
  10. "Planet-scale authentication with Auth0 and DocumentDB". auth0.com.
  11. "Newest 'azure-documentdb' Questions". stackoverflow.com. Retrieved 2016-12-07.
This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.