10 ms·
Azure Cosmos DB: Microsoft's Cloud-Born Globally Distributed Database
- he0001 8y agoDo they guarantee that if a write is done one region, when completed upon return, is available when read in another region?
- balakk 8y agoYes, CosmosDB lets you choose your preferred consistency level. https://docs.microsoft.com/en-us/azure/cosmos-db/consistency-levels https://docs.microsoft.com/en-us/azure/cosmos-db/consistency... The performance impact of different consistency levels are available here. https://docs.microsoft.com/en-us/azure/cosmos-db/consistency-levels-tradeoffs https://docs.microsoft.com/en-us/azure/cosmos-db/consistency... As you would expect, stronger consistency leads to lesser throughput levels.
- uluyol 8y agoI do not think so. When I last tried it they only allowed for "bounded staleness" consistency across regions despite supporting strong consistency within a region.
- dharmashuklaMS 8y agoHi, I am from the Azure Cosmos DB engineering team. All five consistency levels (strong, bounded staleness, session, consistent prefix, and eventual) are available for your Cosmos account, regardless of the number of regions it is associated with. To answer your specific question, yes, if you choose strong consistency, you will read the latest write in any of the regions associated with your Cosmos database. If you choose bounded staleness consistency, you can configure the number of versions (k) or time (t) up to which you are willing to tolerate the staleness for your reads in return for the write to get ack’d immediately (after it is quorum committed in the local region). The documents below describe the consistency levels and tradeoffs: https://docs.microsoft.com/en-us/azure/cosmos-db/consistency-levels https://docs.microsoft.com/en-us/azure/cosmos-db/consistency... https://docs.microsoft.com/en-us/azure/cosmos-db/consistency-levels-tradeoffs https://docs.microsoft.com/en-us/azure/cosmos-db/consistency... Thanks!
- kuzehanka 8y agoAfter trying CosmosDB I put it down pretty quickly. I can't say I'd recommend it to anyone. Shockingly poor perf. Is CosmosDB really that bad or did we have it misconfigured? We're not sure, the docs didn't help us understand. Random failures when connecting. Random errors (or worse, no errors but unexpected results) when querying. Largely undocumented. Painful interop with non-azure proprietary offerings. Almost zero developer community. Most of the coverage of CosmosDB isn't by developers, it's by various MS affiliated blogs such as this one, which are more advertisements than resources. Unfortunately CosmosDB seems to fit the Azure MO of investing more into sales/marketing than into engineering/support. I don't know about the general atmosphere, but in the circles where I work, Azure and its various proprietary components are losing developer goodwill at a staggering pace.
- deleted 8y ago[deleted]
- suff 8y agoPutting it down quickly was your finely tuned technical instincts saving you from disaster.
- m_fayer 8y agoSame experience here. Also found it to be hideously expensive while setting all dials to minimum for experimentation and exploration. There may be a way to configure it for an affordable trial run, but it didn't motivate me to stay and figure it out.
- rnehme 8y agoHi, I am from Azure Cosmos DB Engineering Team. For development (before going into production) with Azure Cosmos DB, we suggest a number of options (also documented here: https://docs.microsoft.com/en-us/azure/cosmos-db/optimize-dev-test https://docs.microsoft.com/en-us/azure/cosmos-db/optimize-de...): [1] Cosmos DB emulator (Cosmos DB Local version) - https://docs.microsoft.com/en-us/azure/cosmos-db/local-emulator https://docs.microsoft.com/en-us/azure/cosmos-db/local-emula.... The Azure Cosmos DB Emulator provides a local environment that emulates the Azure Cosmos DB service for development purposes. Using the Azure Cosmos DB Emulator, you can develop and test your application locally, without creating an Azure subscription or incurring any costs. When you're satisfied with how your application is working in the Azure Cosmos DB Emulator, you can switch to using an Azure Cosmos DB account in the cloud. Support for Cosmos DB emulator on Linux is coming. [2] We provide Try Cosmos DB for free experience - https://azure.microsoft.com/try/cosmosdb/ https://azure.microsoft.com/try/cosmosdb/. There is Try Azure Cosmos DB for free experience which gives you a time-limited full-service experience with Azure Cosmos DB. It is designed for trying out Cosmos DB, doing a tutorial, a demo, doing a quick start, a lab without requiring an Azure account or a credit card. [3] We provide a free tier (Cosmos DB is a part of free account) - https://azure.microsoft.com/free https://azure.microsoft.com/free. In Azure, we support a free tier with 12 month access to all popular services in Azure. As a part of free tier specifically for Cosmos DB you get 5GB in storage and 400RUs. Thanks so much!
- niahmiah 8y agoSounds similar to cockroachdb, by ex google devs https://www.cockroachlabs.com/ https://www.cockroachlabs.com/
- taffer 8y agoCockroachdb is a proper SQL Database, Cosmos is just a Document Store that also has an SQL interface.
- jng 8y agoCan you explain in some precision what you mean by that?
- eclipxe 8y agoSounds petty precise to me already
- deleted 8y ago[deleted]
- manigandham 8y agoSQL = structured query language. It's just an interface to access data. All relational databases offer it but so do many other non-relational systems. This means using SQL to read/write data is completely separate from having relational functionality like joins.
- tannhaeuser 8y agoMay I ask that we shouldn't use the term Document Store or Document <anything> for JSONish data as used by Mongo, and by extension AWS "DocumentDB" and Cosmos DB. The term supposedly emphasizes that data graphs are stored as they are posted and requested by simple webapps (as opposed to normalized relational data), but that still hasn't anything to do with documents as understood by most people. It just poisons the search space (and AWS calling their impl DocumentDB doesn't help either).
- outside1234 8y ago
- bbcfake 8y agoIs hacker news techno tyranny ? Why shadow banning users ?
- shearnie 8y agoCosmosdb still doesn’t support skip and take. And aggregate queries are incredibly inefficient. We’ve had to move a heap of data from cosdb to sql server, our reports ran from 3 hours, to now 5 minutes after moving to SQL.
- cheschire 8y agoI may be taking your post at face value, but I suggest if you are using skip, i.e. LINQ Skip(), that you stop. SQL's performance using OFFSET is pretty terrible when you start getting into the 10's of thousands of records. Instead, use seek instead. Here's some random google result that talks about the concept. There are plenty out there though. https://blog.jooq.org/2013/10/26/faster-sql-paging-with-jooq-using-the-seek-method/ https://blog.jooq.org/2013/10/26/faster-sql-paging-with-jooq...
- manigandham 8y agoHow were you aggregating data? ComosDB is a document-store and not a relational database and wasn't designed for large-scale aggregations. There are ways to use the Javascript UDFs to aggregate data within a partition but across-partitions is not a good fit for this architecture.
- sthota 8y agoHi, I am from Azure Cosmos DB engineering team. We continue to optimize our indexing layout – there are several key improvements being rolled out. Please share the details of your expensive query (askcosmosdb@microsoft.com) to help us investigate. OFFSET/LIMIT (Skip/Take) is currently in private preview. It will be broadly available by 5/15/2019.
- lkschubert8 8y agoThe absolute worst bug I have ever had to debug was using CosmosDB as table storage. Everything worked fine up until we hit about 1700 records in table storage. Once we hit that point it just stopped returning any records. We eventually find out that if you query using a field that isn't indexed instead of throwing an error or something sane like that it acts like everything is fine and returns an empty set of records.
- skrebbel 8y agoWoa, wtf. Is that indicative of the general quality level of cosmos?
- zzbzq 8y agoSort of. It doesn't really sanity-check anything, ever. It's more of a blank slate and you have to build whatever rules you want into your software layer. The default mode is to index every field, so you can't get into the OP's situation until you start trying to fine-tune it. He basically turned off the index and then tried to search by it. This is not expected for people who just bring their RDBMS assumptions in and try to wing it without reading any documentation whatsoever.
- lkschubert8 8y agoI dont know if something changed, but there were no default indexes back when this happened (a year and a half ago). I had done no performance tuning, just created the document collections and added items to them.
- AaronFriel 8y agoIt sounds like you inadvertently changed the index structure or deleted it. There have always been default indexes, and Microsoft's tuning advice is always to add special case indexes to the wildcard index they provision. If you know your data model well and want to improve write performance (RUs), you can delete the wildcard index. That's how the indexing policy has worked since the product launched. https://docs.microsoft.com/en-us/azure/cosmos-db/how-to-manage-indexing-policy https://docs.microsoft.com/en-us/azure/cosmos-db/how-to-mana...
- suff 8y agoFTA: "say datacenter automatic failover component, in one part of the territory. Getting this component right may take months of your time. But it is OK. You are building a new street in one of the suburbs, and this adds up to the big picture." Wait, what?! Driving metaphor aside... 'MONTHS of your time' to implement failover? People, this is WHY the cloud was invented, so we didn't have to spend months re-inventing. In AWS and even GCP, this takes a day or less if you know the (well documented easy to use) storage offerings. Seriously reconsider your selection criteria when you start saying things like this, because what I just heard is that my team just told me implementing failover is going to cost $60k. Guess how much easier that made my case to switch to another cloud-native offering? TCO over everything. Even Ballmer would agree with that - he made the same case for Windows, against Linux in the 90's.
- silverlake 8y agoHe's talking about building the underlying failover mechanism for CosmoDB. For a customer it's easy and automatic, but GCP and AWS and Azure have to build it first.
- rad_gruchalski 8y agoBut months?
- manigandham 8y agoTo build a globally distributed database offering as complex as Cosmos DB with multiple SLA requirements? Can you build it faster?
- suff 8y agoSurely you're referring to Microsoft's team's time to implement failover to the product offering, not time every customer spends on implementation??? FTA: "if _you_ are an engineer working on a small thing, say datacenter automatic failover component" (emphasis added). Pretty sure he's talking about EVERY customer spending months to turn on fail-over.
- marcelftw 8y agoIt costs an arm. It's not event mongo 4, it has a subset of mongo 3.6 features : not all aggregations queries are available. Would not recommend.
- deleted 8y ago[deleted]
- kerng 8y agoCosmosDB used to be called DocumentDB, which now Amazon uses as name for their service too.
- youdontknowtho 8y agoThis was a really interesting write up. Doing a sabbatical with a large distributed systems team sounds really cool.
- ignoramous 8y agoThis post is interesting but one or two MS employees did reveal some key details about CosmosDB in the original announcement thread: https://news.ycombinator.com/item?id=14308814 https://news.ycombinator.com/item?id=14308814 (edited) > There are many significant differences in capabilities, and design approaches between other systems (CockroachDB and Spanner) and Cosmos DB. At a very high level differences are at two levels - the design of the database engine and the larger distributed system. > The database engine design is inspired by > 1. LLAMA: http://db.disi.unitn.eu/pages/VLDBProgram/pdf/research/p853-levandoski.pdf http://db.disi.unitn.eu/pages/VLDBProgram/pdf/research/p853-... > 2. Bwtree: https://pdfs.semanticscholar.org/7655/9c6cc259c6ab5baf7bd19dd54bb6c773736a.pdf https://pdfs.semanticscholar.org/7655/9c6cc259c6ab5baf7bd19d... > 3. Schema-agnostic indexing techniques: http://www.vldb.org/pvldb/vol8/p1668-shukla.pdf http://www.vldb.org/pvldb/vol8/p1668-shukla.pdf. > Please note that these papers are significantly behind the current state of the implementation. The most crucial aspect that these papers dont cover is the integration of the database engine with the larger distributed system components of Cosmos DB including the resource governance, partition management, and the implementation of replication protocol / consistency models etc. > Our goal is to publish all of the design specifications including TLA+ specs over time. --- https://azure.microsoft.com/en-us/blog/a-technical-overview-of-azure-cosmos-db/ https://azure.microsoft.com/en-us/blog/a-technical-overview-... https://azure.microsoft.com/en-us/blog/azure-cosmos-db-pushing-the-frontier-of-globally-distributed-databases/ https://azure.microsoft.com/en-us/blog/azure-cosmos-db-pushi...
- dtrailin 8y agoThe TLA+ specs where eventually published [0], although I wonder how up to date they are to current state of the DB since they haven't been updated for a while. [0] https://github.com/Azure/azure-cosmos-tla https://github.com/Azure/azure-cosmos-tla
- rnehme 8y agoHi, I am from Azure Cosmos DB Engineering Team. The TLA+ specs are fairly up to date. Thanks.
- chupa-chups 8y agoWe used it also. Ran into the issue that collection (?) names are limited to 64 chars(1) (which wasn't documented anywhere), triggering obscure errors while everything was fine from the Azure Frontend. Also even simple queries using an index (and a uniform document structure) cost a comparatively huge amount of RUs compared to a competitor. Icing on the cake was the non-support for paging at that time, and a total fuck-up when we tried a restore from backup operation (which can only be done by calling MS support, no automated way possible). If anyone wants to know details I can provide those. Needless to say we switched to another provider. (1) the names were generated by our automated deployment step, something like {environment}_{product}_{collection-name}
- jbreiding 8y agoAny reason you wouldn't use resource groups and db/collections for segregation instead of encoding into the collection name? I believe all of that hirearchy ends up in the resource URI if you really need it encoded there.
- sthota 8y agoHi, I am from Cosmos DB engineering team. For SQL API, the collection names have a limit of 255 bytes (we will update the documentation). For Mongo API, we honor the limit prescribed by the API for the combination of <database>.<collection> to be 120 bytes as explained here - https://docs.mongodb.com/manual/reference/limits/#Restriction-on-Collection-Names https://docs.mongodb.com/manual/reference/limits/#Restrictio... We continue to optimize our indexing layout – there are several key improvements being rolled out. Please share the details of your expensive query (askcosmosdb@microsoft.com) to help us investigate. OFFSET/LIMIT (Skip/Take) is currently in private preview. It will be broadly available by 5/15/2019. We are working on customer controlled PITR, which will be available later this year. Thank you for the feedback!
- ZeroCool2u 8y agoBased on the feedback here, it's hard to imagine anyone choosing Cosmos DB over Spanner or just CockroachDB. I'm not familiar with the AWS equivalent, but it seems like Azure isn't exactly setting the bar high.
- manigandham 8y agoSpanner and CockroachDB are distributed relational databases. CosmosDB is a JSON-based document store. It offers interfaces that emulate the ability to use SQL/Cassandra SQL/Azure Table/Gremlin graphs but this doesn't necessarily add functionality like relational joins.
- jjirsa 8y agoReally? You can’t figure out why someone might use a Microsoft hosted db over one at google or one they’d have to run themselves? Azure’s growth rate is amazing. There’s a ton of adoption there that doesn’t have access to spanner, or maybe has a document based data model, where spanner / cockroach doesn’t make any sense
- deleted 8y ago[deleted]
- onedataguy 8y agoComments here are rather negative yet service is growing very rapidly so there is a disconnect. I would encourage you to try service and develop own perspective.
- manigandham 8y agoCosmosDB does have problems but the comments here seem to mostly be about not understanding the data model. It's a JSON-based document-store that distributes data across partitions. It offers several interfaces (set at the database level) but that doesn't mean all the functionality is supported. It works well with MongoDB, Cassandra, and Table storage but you won't get relational SQL joins or fast graph search queries in Gremlin. I agree that marketing and documentation is poor which leads to these misunderstandings. Multi-model is never perfect and people forget that emulation has a cost in performance, price and functionality.
- outside1234 8y agoThe problem is that their marketing and docs make it sounds like it is the solution for everything. Legacy Cassandra workload? Use CosmosDB Graph Database? Use CosmosDB Legacy MongoDB database? Use CosmosDB SQL Server database? Use CosmosDB When the only really valid use case is: Document Database? Use CosmosDB
- manigandham 8y agoYes, I said exactly that. Multi-model is a hard problem and only really works with similar data models. It's also confusing since people conflate SQL and relational semantics when it's really just a query language. It does work well enough if you have an OLTP document use-case like MongoDB, Cassandra, and JSON/SQL.
- dagss 8y agoDisagree about "conflate". SQL is very geared towards relational semantics. They may be independent in theory (a stretch), but any non-trivial SQL query (say a medium sized one with 50 lines abd 10 tables) is meaningless without a relational DB underneath. What Cosmos calls "SQL" is not SQL at all, it lacks almost everything, it just borrows a few keywords. If you cant even do inner joins and left joins and so on between different tables, it is NOT anything close to SQL. Joins is sort of the point of SQL.
- jjirsa 8y agoHey CosmosDB team in the comments: Building distributed databases at scale is hard af, few people know what it’s like to run hundreds of thousands of databases. Don’t be discouraged by random negative posts, remember you’re doing something most of the world can’t do.
- onedataguy 8y agoAppreciate it.
- pratnala 8y agoThanks for the kind words.
- manigandham 8y agoHere's a tech overview of Azure Cosmos DB form last year: https://www.youtube.com/watch?v=V_C7DlKVofc https://www.youtube.com/watch?v=V_C7DlKVofc Should help with most of the questions here.
- deniswsrosa 8y agoAs far as I know, apart from the global distribution, virtually any major database offer the same thing today
- dagss 8y agoBeware of the REST API of Cosmos. We fell into the trap of using it.. 1) it is not covered by the latency SLA. This is buried pretty deep... 2) suddenly you get magical responses that are supposed to trigger the client to do something (e.g. sql qyeries with order by requires some algorithm client side). These things are not docoumented anywhere, you have to read the Node or Python client libs.. Using Cosmos mainly requires being on .NET and using the official driver that communicates over a closed undocumented binary protocol. (even the Java driver having the full SLAs and using the binary protocol was launched just weeks ago). IMO it would have been less misleading if MS had just removed the docs for their REST API. Or at least put up a big warning about it being an undocumented afterthought.
- Vulkum 8y agoIn general I have issues with the Azure documentation. I can't put my finger on it as to why, but for some reason the information doesn't seem to be presented in coherent ways, it's often disconnected and gets outdated very quickly. I can't speak as to the performance of the drivers (in general using the database drivers or a gRPC/thrift equivalent should be better than REST), but I agree with the lack of SLAs. The lack of SLAs in the documentation is one of the major issues we've had when assessing the suitability of Azure managed services (e.g. Postgres, Cosmos DB, Bus, Event Hubs, etc.). To Azure's defence (not sure I should be doing this), a lot of these services are new and they are made available before they are operationally ready. For example, I was looking at the SQL warehouse offering a few months back [0] and if you want to use it you'd have manually maintain the statistics of the DB to keep the query plans optimised. It just seems like more overhead than necessary. [0] https://docs.microsoft.com/en-us/azure/sql-data-warehouse/sql-data-warehouse-best-practices?fbclid=IwAR1lWHSodX1vsX1-wioZUeV2R7yUmlBWQ6Br8-XVXWYBmgwYEKYdt-kRZ6g https://docs.microsoft.com/en-us/azure/sql-data-warehouse/sq...
- kirillg_hn 8y agoHi, I am from Cosmos DB engineering team, Cosmos DB offers Java, Javascript, Python, and .NET drivers. Just like with most databases, it is recommended for applications to use drivers to work with Cosmos DB. Cosmos DB offers REST API to work with data, documented at [1]. The primary focus of the REST API is SDK developers for platforms where we do not provide drivers yet. Just like most databases, we recommend to use provided drivers where available. This REST API is not intended for broad consumption by the apps. Your point about being more explicit about scenario the REST API is intended for and supported for is well taken. We will improve the documentation. [1] https://docs.microsoft.com/en-us/rest/api/cosmos-db/ https://docs.microsoft.com/en-us/rest/api/cosmos-db/ thanks for feedback!