226 points · by aphyr · 9y ago · 162 comments
Open and available for everyone to see, for every build of MongoDB. Is there another database that has this much transparency? (for every build)
I at least will never trust Mongo for anything but a toy project. There are so many better options out there, options whose technical capabilities are as good as Mongo's marketing.
Maybe. But you'd have lost that bet if you made it any day in the last 10 years. And in those 10 years mongodb has demonstrated again and again that they aren't up to the task of writing a reliable database. Even with their new storage engine they couldn't find the bugs alone.
I think using mongo today for any mission critical data is an irresponsible choice. I'd seriously question the judgement of any senior engineer who picks it for a new project over rethinkdb or Postgres.
But with Jespen tests MongoDB can finally be considered a contender. Its not like competent teams were using it in production. Right?
That depends on the data.
What type of data you have and what you want to do with it.
MongoDB isn't data specific and it claim to fame is flexible data structure.
If you want fast write and look up with very little relation Cassandra is good.
If you want searchable text document then anything that is base on Lucene is good (ES, Solr, Raven).
If you want time series there are few out there but it's a niche.
Likewise if you want graph data then there are NodeJS, Titan, etc..
MongoDB at most company I worked with was use because they don't think about what type of data it is and what performance they want. They want to store unstructure data cause it's easy.
I personally think it's a cop out, especially as a statistician/programmer.
> As far as I can ascertain, RethinkDB’s safety claims are accurate. You can lose updates if you write with anything less than majority, and see assorted read anomalies with single or outdated reads, but majority/majority appears linearizable.
The safety claims are accurate but like all databases, its never 100% perfect as there are tradeoffs.
https://aphyr.com/posts/330-jepsen-rethinkdb-2-2-3-reconfigu...
> That reordering was only possible because of a special workaround for a bug in an older version of RethinkDB.
> What are the risks to users? The RethinkDB team and I suspect it’s unlikely this bug will occur outside of stress testing. Cluster reconfiguration is typically infrequent, and users would need a specific series of network failures or other message delays which happen to cut the replicas apart—in a way which allows both network components to find independent majorities for their respective table configurations. In Jepsen tests, it usually takes tens to hundreds of partition/reconfigure rounds to trigger this bug.
This isn't really an architectural failure (as you see repeatedly with MongoDB) but an implementation bug.
Compared to the failures in MongoDB that are frequently architectural (rather than implementation bugs), RethinkDB passed easily and quickly fixed the implementation bugs.
Depending on the exact requirements Postgres (in the right configuration) and Redis are better options.
I'd argue that for 90% of MongoDB users - the group whose requirements were met by MySQL/MyISAM - would be better served by Postgres or MySQL with a proper storage engine.
Given the projects I chose to work on, MongoDB would be a bad choice. So I would only use it for a toy project right now. In 3-5 years time I expect that it will be a very good choice, given that they've pretty much won and can hire all of the good engineering talent.
The parallels with MySQL are really astounding; I just hope that they don't end up being sold to Oracle or Microsoft.
> While the v0 protocol remains broken, patches for v1 are available in MongoDB 3.2.12 and 3.4.0, and now pass the expanded Jepsen test suite.
Not exactly, but we published a blog post about why we took the time to write a new CI system, and that post does touch upon why we didn't use Jenkins + plugins.
https://engineering.mongodb.com/post/evergreen-continuous-in...
The team at MongoDB really cares a lot about making the best database product possible. I knew it when I was there and still think so after I've left.
When choosing a database, caring is only one aspect of it. It's necessary, but not sufficient.
None of the criticisms I have ever seen or heard about MongoDB were related to Mongo Inc and their office culture but rather their product.
[0]: https://docs.mongodb.com/manual/tutorial/resync-replica-set-...
>The team at MongoDB really cares a lot about making the best database product possible.
... some what ironic.
Its open to anyone by default, eats all memory and then crashes! I had it on and off my machine in less than one week and won't plan to go back.
n.b. I can't find the original "Call Me Maybe" post, but this later one [1] is similar.
HN Discussion: https://news.ycombinator.com/item?id=9417773
Any more information on this? How did he "solve" the problem?
Edit: straight from the horse's mouth [0]
By comparison, it's the difference between a bug report that says "you lost my data, you suck!" and "I've identified [x] ways your product can lose data and here's exactly how to reproduce each one."
It seems the problems were indeed "solved" and not solved.
In 2013, I performed an unpaid analysis, in my nights and weekends, of MongoDB. I found a bug leading to the loss of acknowledged writes with majority write concern. Mongo fixed this bug within a few weeks.
In 2015, I performed a followup test as a part of my work at Stripe. I confirmed dirty reads (which were already documented, though perhaps not well-appreciated), and discovered stale reads (which ran counter to MongoDB's documentation). MongoDB wasn't enthusiastic about that report initially, but got things sorted out and started work on adding majority and linearizable read concerns. I found that writes appeared linearizable.
In spring and summer of 2016, MongoDB paid me to help expand the Jepsen tests and hook them up to their internal CI system, so they could use the Jepsen tests to help verify their ongoing work towards linearizable reads. I privately confirmed that MongoDB still failed to prevent stale reads, but the dirty-read failures I'd seen in 2015 appeared to be prevented by majority reads.
In fall 2016, MongoDB announced they were almost ready to release 3.4.0 with support for linearizable reads, and paid me to perform a full analysis so they could be more confident in the results. It passed the linearizability tests I had initially written in 2015, but I offered to expand the tests to be more aggressive. Our collaboration resulted in the present analysis, uncovering design flaws in v0 and implementation bugs in v1. MongoDB worked to develop patches prior to 3.4.0's release, and that's why it passes now. :)
I like it.
There's no "standard practice" that I know of--very few people are doing this kind of work. Behind every one of these analyses is weeks of contract negotiation where I try to convince assorted lawyers & CFOs to go along with my weird, idealistic ethical policies. And conversely, those lawyers and CFOs do their best to balance the desire for correctness with their duty to protect the company. This policy outlines how we compromise.
Originally I did offer a client veto, because clients weren't willing to sign without some assurance of control over the outcome. My current standard contract for analyses actually drops that client veto: I have final say on the analysis content and publication. There's still a grace period to allow the vendor to fix bugs & get things in order. I'm adopting this as the standard going forward, but it's been a long road to get there.
That said, I do perform private consulting--usually for in-house systems, sometimes for clients that can't afford a full analysis, and sometimes as a precursor to more involved work. That means that yes, vendors may be aware of bugs and I won't have told you about them--but I promise that my public work remains honest and forthcoming.
Curious, is there any single book you would say you've found to be the equivalent of say CLRS but for the fundamentals of distributed computing paradigms?
My current plan for deep diving into distributed systems theory has just been to go through resources like "Distributed systems for fun and profit", and aggregated lists/overviews like https://henryr.github.io/distributed-systems-readings/ and your distsys-class notes and then just DFS into certain topics from there - compared to the approach I've been taking with deep diving into OS and database theory which is just to go through text books like Operating System Concepts and Database System Concepts while applying the theory in side projects.
> "Once I've prepared a written analysis, the client may defer publication by up to three months. This gives the client a chance to understand the faults I've identified, attempt to fix bugs, update documentation, and deploy fixes to users."
So, a client can get the analysis done and attempt to defer publication for three months, after which time it'll be published. No?
I think that this really shows how mature of a Database MongoDB is.
I'd say the marker of maturity here is that MongoDB has put significant time and effort into correctness: they take clock skew and network partitions as serious failure modes, they've redesigned their replication protocol, added options for stronger reads, and invested in their own correctness test suite, and Jepsen tests, as a part of their CI process.
For example, Kyle integrated some serializability tests into the VoltDB Jepsen testing that wouldn’t apply to Mongo.
Or that it took this long for them to pass basic proficiency tests. How do other database systems fare with these tests?
That being said, none of the big players in sql are there, so you can't size it up against postgres or mysql.
Wait, it is me not understanding what the abstract is trying to say?
Giving aphyr some money to do this makes me think much more of Mongo now; I wouldn't previously have considered it for serious use but this is an excellent demonstration of intent.
I want to see more than just one test from more than one source and seeing their sketchy performance in the past only time will tell if this new version will be any better.
> I think that this really shows how mature of a Database MongoDB is.
Yeah no. It's a test. We have to wait and see in productions and see the data to prove that. It's also the first version to past this test. It means something but not a whole lot without real production data and other people attesting to it.
taken from their page : https://www.mongodb.com/mongodb-scale
This should give people some insight on why MongoDB is being used in the industry.
How is the performance with the new v1 protocol? (still faster, I'm sure)
https://rethinkdb.com/blog/rethinkdb-joins-linux-foundation/
I can't imagine developing any software that involves relationships between entities that does not have data consistency. Check constraints, foreign keys, and data type validation all provide a minimum sanity level of the underlying data that allows your mind to focus on more important things. Otherwise you're entire application is going to be littered with those same sanity checks.
I'm not saying that all apps need that type of data store or that there isn't room in this world for NoSQL stores, I mean specifically that complicated interdependencies and validation checks lend themselves well to the relational model.
The client will never experience Committed unless it really is committed, and thus never report that it was successful to the user.
At the very least I'd want to know exactly how much data loss we are talking about, which is probably harder to answer than just using a platform that doesn't suffer data loss in the first place.
Obviously this is true of many products, but how serious is it in practice? The criteria for 'good enough' can't be passing Jespen because very few db's do.
Storing schemaless json is a very valid use case. And the fact is there aren't really many proper NoSql alternatives, other than RethinkDB, which I hope becomes popular, and maybe Couch. e.g. Cassandra is often touted but its a k-v store, not a document db.
There's a reason Mongo became and continues to be popular. I still think Rethink is superior in every way.
What currently still makes MongoDB nicer than e.g. Postgres JSON are the libraries embracing schemaless while JSON in PG libs still feels tacked on.
Recently I had some bad experience with MongoDB support though.
No experience with RethinkDB.
I guess there are those who will say that even using batch-commits, that MongoDB could never have achieved the performance it currently does (by bypassing any ACID) if it was built on top of MySQL. But regardless, why not focus efforts on improving MySQL batch processing performance rather than throwing it all out, starting from scratch, and writing directly to disk. I know MongoDB became a success, but I think that is 'in spite of' their decision to start from scratch and not 'because of' it. Also think of the power that would be available if there were some relational table capability (true real MySQL ACID) right inside MongoDB whenever it was needed, if they were the 'same animal', rather than having to use two totally and completely separate DBs if you need NoSQL and also ACID in an app, which 99% of apps DO NEED, at some point, once an app grows beyond the round-one funding startup-toy phase and MongoDB falls flat in it's RDB capabilities.
Just use Postgres (or several other options) then? It has all that built right in if it's what you need. But...
> if you need NoSQL and also ACID in an app, which 99% of apps DO NEED, at some point,
...I doubt 99% of apps really need this.
> once an app grows beyond the round-one funding startup-toy phase and MongoDB falls flat in it's RDB capabilities.
Or don't try to force MongoDB to behave like a RDB and you won't hit those problems? I just moved a system from Postgres to MongoDB, and it's running faster on way cheaper hardware now. Not because either database is inherently better than the other, but the use case lined up with mongodb perfectly and the old model was leveraging Postgres really poorly. Eventual consistency is fine, and I can denormalize certain data for faster reads because I know it won't be modified later.
I think relational-type queries are so common that any significant app will need them. For my own side project (meta64.com) I'm using JCR-SQL2, on Apache Oak jackrabbit, so I get to do lookups fairly easily, but it sure would be nice to have a full-blown ACID RDBMS engine sitting right there to use also, in the same engine.
There are two challenges here. One is that MongoDB has a different data model than MySQL: hierarchical, schema-less documents instead of uniformly-typed flat tables. It's possible to map one to the other--look at Postgres' support for JSON datatypes. That involves extensions to both the storage format and query language, but it's certainly doable.
The bigger problem is that MySQL's local transactional isolation is nice, but not particularly helpful in a distributed context. Distributed transactions--even single-document ones--are still tough to implement correctly and efficiently. As an example, consider Percona XtraDB, or MySQL+Galera Cluster. Both are building on a serializable single-node system--but in a distributed context, they wind up failing to provide snapshot isolation, let alone serializability.
Taking really old code and trying to make it do new things is very very hard. After you've invested all that time and effort making mysql better, it's still a database owned by oracle.
Think how Java would have turned out if Sun made it to be cross compiled to C rather than run in a VM.
There are plenty of examples in the Language world also: Go, Rust, etc. All those new languages SHOULD have built on top of Java, for the same reason Mongo should have built on top of MySQL. BTW, Java DID leverage C++. The Java compiler IS written in C. Mongo didn't use any part of MySQL, but Java uses EVERY part of C.