309 points · by aphyr · 9y ago · 203 comments
I understand the txn/s numbers are in a pathological scenario, but will these transactions block the whole db from moving faster or have unrelated transactions still normal throughput?
I'm just glad we get linearizable single keys, I had to switch to HBase because it was the only choice at the time. Cassandra did not even give me read-your-own-writes. HBase also had issues while testing on the same host, delete+write lead to deletes being reordered after the writes because they had the same timestamp.
I'm a bit disappointed from HN in this post, everyone only talks about the name. But 90% probably did not even read the article. Aaanyway, heres my 2cents: https://cr.yp.to/cdb.html is CDB for me :P - so better choose another acronym!
Not clear if you're referring to PostgreSQL or CockroachDB, but for the record, the PostgreSQL default transaction isolation level is READ COMMITTED, not SERIALIZABLE.
https://www.postgresql.org/docs/current/static/sql-set-trans...
All transaction interactions are localized to particular keys, so other transactions can proceed normally while there is contention in an unrelated part of the database.
(as for the acronym, we prefer CRDB instead of CDB)
In practice this means no cross key serializability without including a serialization token in transactions.
I may be mistaken however but that is my understanding from reading CockroachDB docs and Aphyrs post.
Wow, that's...not fast.
Jepsen is essentially a worst-case stress test for a consistent database: all the transactions conflict with each other. CockroachDB's optimistic concurrency control performs worse with this kind of workload than the pessimistic (lock-based) concurrency control seen in most non-distributed databases. But this high-contention scenario is not the norm for most databases. Most transactions don't conflict with each other and can proceed without waiting. Without contention, CockroachDB can serve thousands of reads or writes per second per node (and depending on access patterns, can scale linearly with the number of nodes).
And of course, we're continually working on performance (it's our main focus as we work towards 1.0), and things will get better on both the high- and low-contention scenarios. Just today we're about to land a major improvement for many high-contention tests, although it didn't speed up the jepsen tests as much as we had hoped.
I've been testing with node.js's pg client (not even using the 'native' option) and on 1 node I get > 1,000 single inserts /sec. I'm seeing this scale linearly too. NB I'm testing on a pretty overloaded macbook with only 8gb RAM. On a decent-sized cluster with production-grade hardware and network, performance is really unlikely to be a bottleneck. Also, it'll significantly improve during this year, one imagines.
All databases tend to struggle to under contention. If you are an application author building a high-scale app, you need to avoid contention by design. That single counter row you were planning to increment on every visit? Bad idea; maybe insert a new visit record instead.
The contention in this example is an aspect of the test design, not database design. You wouldn't try to build an app this way.
a.) this is a beta product where the team has been focusing on completeness and correctness before performance
b.) I was testing Cockroach from August through October--Cockroach Labs has put a good deal of work into performance in the last three months, but that work hasn't been merged into mainline yet. I expect things should be a good deal faster by 1.0.
c.) Jepsen does some intentionally pathological things to databases. For instance, we choose extremely small Cockroach shard sizes to force constant rebalancing of the keyspace under inserts. Don't treat this as representative of a production workload.
When there are basic expectations of behavior that aren't being met, many of us would reject the idea that this code is 'correct'.
The test is testing the worst-case scenario of everything needing locking. CockroachDB uses an optimistic "locking" approach which makes this bad. But if you're use-case is strictly linearizable high-throughput reads good luck finding anything that is not a single-machine database.
I'm curious, do any of the cloud providers offer instances with high-precision clocks? Maybe this is something one of the smaller cloud providers might want to offer to differentiate themselves - instances with GSP clocks.
Edit: Quote from Brewer's post: "Next steps For a significantly deeper dive into the details, see the white paper also released today. It covers Spanner, consistency and availability in depth (including new data). It also looks at the role played by Google’s TrueTime system, which provides a globally synchronized clock. We intend to release TrueTime for direct use by Cloud customers in the future."
Essentially that's what Google's doing by selling Spanner, but you don't get access to the clocks directly. I'd guess that as they get more experience selling Spanner, and they bring the price of the hardware down, they'll rent those directly too.
That's a great question.
Could be a little tricky with AWS for example. It's typical to run a database on a VPC (virtual private cloud), since that layer of the stack doesn't need to be exposed to the Internet. Unfortunately, that means the servers in the VPC can't get to the ⁎.amazon.pool.ntp.org servers.
Skimming around, I don't see any of the cloud providers, VPS providers, or dedicated hosting companies offering anything special, like a local stratum 1 time source for each region/location.
In addition to being extremely precise, TrueTime is explicit about error in its measurements.
In other words, a call to TrueTime returns a lower and upper bound for the current time, which is important for systems like Spanner or CockroachDB when operations must be linearized.
In effect, Spanner sleeps on each operation for a duration of [latest_upper_bound - current_lower_bound] to ensure that operations are strictly ordered.
Your suggestion might improve typical clock synchronization, but still leaves defining the critical offset threshold to the operator, and importantly leaves little choice for software like CockroachDB other than to crash when it detects that the invariant is violated.
I am pulling for them over G on principle. I infer they know people at Stripe where the Rethink team & Aphyr are so hopefully they can learn from them and build an awesome product. G has lost a lot of battles on UX, Docs, attitude and just general product. They have won a lot of battles on sheer size & resources. Be nice to have this stick around.
Interesting and hilarious coverage of technical complexity which assumes just enough knowledge to engage a keen novice while seemingly engaging seasoned experts in the field.
Thanks for that. Your entertainment firm is a bit out if my wheelhouse, but it's such a crowded space and you end up getting really tied down. Maybe get acquihired for an Iditarod team, but I reckon this is more scaleable.
Posts are great. Tganks
That said, I'd really appreciate if they'd launch a hosted DBaaS. By that I mean, more in line with dynamodb or documentdb instead of say MySQL on AWS for example.
I know it's on their timeline, but dbs generally get selected during the start of the projects and unless absolutely necessary, companies don't want to change dbs.
A concern I have is that there could be datacorruption in this context, no? It sounds like on a per cluster basis, i.e. Same Raft cluster, there is a strict serializability guarantee. But without linearalizability system wide, you could end up with data corruption on multi-keyspace writes.
To speculate: if clocks do go out of bounds, I don't... think... you can violate single-key serializability, because that goes through a single Raft cluster, but you can definitely see multi-key consistency anomalies. I think you could also get stale single-key reads, because the read path IIRC relies on a time-based lease. Might be other interesting issues if Cockroach is shuffling data from one Raft ensemble to another--I think the range info itself might have a time-based lease that could go stale as well. Perhaps a Cockroach Labs engineer could comment here?
Note that the time window for these anomalies is limited to a few seconds-nodes will kill themselves when they detect clock skew.
I only recently read some cool things about CDB and wondered if I could have been subconsciously skipping articles about it for deep seeded reasons like http://bbc.com/future/story/20140918-the-reality-about-roach...
Of course anything good may eventually rise to success on its merits, but in case I'm not the only one with a subconscious aversion maybe the info below will help put some people one less click away. How about SurvivalDB? :)
CDB is a distributed SQL database built on a transactional and strongly-consistent key-value store. Scales horizontally; survives disk, machine, rack, and datacenter failures with low latency disruption and no intervention; strongly-consistent ACID transactions; SQL API for querying data. Inspired by Google’s Spanner and F1. Completely open source.
https://cockroachlabs.com/docs/frequently-asked-questions.ht...
To any Cockroach Labs folks who might read this: please give me (and all of us) a name that I can evangelize without my audience cringing.
I've worked with my company's executive team for quite a while, and they're not obtuse. They are human, however. When I go to them and suggest we trust our data to a new, up-and-coming database, I'm asking quite a lot. The cost of failure is extremely high, so I need to convince them at both an emotional and rational level that the risk is worth it. But when the conversation starts, "let me tell you about Cockroach..." I'm already starting from behind.
The reason so many people are fussing about CockroachDB's name is because there's such a huge dissonance between a product that looks fantastic on its technical merits but has a name that triggers terrible images. Have you ever lived in a house with roaches? That's the kind of thing that wedges in your mind in the "never again" category.
This is an issue with a lot of weird or jokey project names, honestly.
It also makes your employees look stupid when they tell their landlords, bank accounts, dates that they work at Cockroach Labs. Good luck explaining that you aren't an exterminator.
.. so probably not a good name either, at least not in Europe. ;-)
I don't want to have to make the case for why someone's system needs rust and cockroaches.
Contrary to most above, I think "Cockroach" is great. It's suitable. Any suit who has a problem with it should get back on their side of the office, and stop sticking their nose in things they know nothing about, especially when so evidently closed minded. There are too many people in that meeting. Hell, even "Google" is a crap name, sounding like a baby word, and "Mongo" can be outright offensive. I expect anyone who has an issue with the name "Cockroach" is probably not going to be too open to the cutting edge anyway, so wasted concern.
Otherwise, its a realistic issue has to be addressed.
Style over substance.
If you have to explain "we want you to think about survivability, not health violations," then maybe the problem isn't your untucked shirt--it's the big grease stain covering its front. You can insist that's just part of your style all you want, but it's going to be a hard sell.
I appreciate the name, but I think I'd have an easier time convincing people to use a product of a different name....
A really bad name, would be, for example, to try calling a news agency "BuzzFeed News".
I admit it's a bias of mine and I could be losing out on learning amazing tools. But even non-profit, standardized languages and tools still have a brand name and image.
At least, it's miles ahead of Cockroach or Rust or even Mongo.
I'm not marketing guru, but maybe cockroach could have been more palatable by calling it "RCH, some call it roach, because it was named after its persistence" ?
https://hive.apache.org/ (Look at the anguish in this creature's face)
?
If we could go back and rename Windows Hitler would anyone be using it???
CXO: What CDB stands for? Presenter: Cockroach Database! ...
It's not my company or me, it's my clients. Here's a sort of long winded story explaining what I mean that the corporate world can't use anything with the name "cockroach". If you disagree after reading, I'm open for a friendly debate.
Average project, some 60 year old VP signing off on 100k of custom software with 8 pages of lawyer speak contracts is NOT going to allow "his" project to run off of "cockroach database". VP's/CEO's like to take personal ownership of projects they feel will go well, and ones done with us usually do. None of these people want ANY chance of their project getting criticized internally, so nobody will use CockroachDb. It's just not going to happen. Having successful projects is an easy way for these people to gather promotions and respect. Having any part of it do with "cockroach" could result in the whole project being an embarrassment.
Imagine the database goes down one day. One of their low level staff calls us(we have ongoing support contract). Problem gets rapidly escalated to development. One of our lead developers replies to the email thread, that by now has a third of the clients' company on it. "Yeah see the problem was the cockroach database that wasn't supposed to go down needed to be restarted" . Most of the staff think we're joking. Guarantee this becomes a big pun around their office, every time anything breaks in the app they say "maybe the cockroaches on the back end died again".
It's made worse by the fact that issues in software systems are commonly called "bugs". Well, our system doesn't have general bugs anymore, it has "cockroaches". Do you think this is an unlikely scenario? Because it's not. Besides the word "cockroach" this is exactly how urgent issues tend to be reported and fixed. Replace "cockroach" with "Microsoft" and I've probably violated my NDA. After that incident, whoever championed the project, probably our strongest ally in the company, resents us for making such a stupid mistake that resulted in his project becoming a joke. Maybe we aren't as great of a dev shop as he once thought? Maybe it's better to do open bidding next time so whoever wins he can't be blamed directly for what happens.
You could say their company culture sucks, maybe it does? But that doesn't change that I can't use it on any client projects because of the chance we'll lose hundreds of thousands over a stupid name.
There's plenty of other names that convey meaning but don't make lawyers nervous. Your attitude of "oh, well if you can't use it your company culture sucks" is EXACTLY why nobody will rename it and why corporate american won't touch it. Nobody cares about how cool it is to be edgy when millions of dollars are on the line. If you plan on forcing clients to use it you might as well hold a going away party for any of your clients with more than 5M revenue.
Intensely hyperbolic but... you're not wrong. "Cockroach" is an awful name for a database and I have a hard time envisioning "seen-it-all" enterprise IT managers taking it seriously.
That didn't take long. https://en.wikipedia.org/wiki/Godwin%27s_law
From my perspective I'm glad something that's trying to do this is coming into existence. a couple years ago I was given the arduous task of ensuring that we never lost data. One of the requirements was that: At any time, any server can (and will) fail.. if you acknowledge that you have data then you MUST never lose it.
You cannot imagine how many database solutions that ruled out. Including basically _all_ noSQL data stores.
We settled on postgresql, because, despite going into toast tables and having to implement sharding on top- it was not only the most sane it could be wrangled into basically doing the right thing in regards to fsyncing and ensuring data wasn't in VFS.
So, Kudos to these guys, who, in a world of people who don't give a shit about consistency (except eventual consistency) are actually trying to further it.
For any database product, there are plenty of mature and robust technical tools for improving and evaluation. I do not believe the company is less aware of any HN commenter. Therefore any technical feedback only going to have limited impact.
But the naming feedback seriously helps them get an idea how their naming hurts their brand-acceptance.
By all means, that's a valuable feedback.
This is a common mistake. The choice doesn't actually guarantee consistency at all. PostgreSQL only guarantees consistency as long as you don't try to communicate with it over a network, which you obviously do if you have shards. To address this problem we have things like 2pc, but they aren't very useful for an RDBMS on their own without the whole infrastructure of a distributed database.
So the least you have to do is to wait for a second server to confirm the write. But now what do you do when the network link between the two servers goes down in-between a write? The write might have already been applied on the first server or it might not have. The same goes for the second server. But you can't be sure either way.
For our thought experiment, let's assume that while the servers can't talk to each other anymore, some clients can still talk to each of the servers.
At this point, you either have to give up availability (i.e. don't accept any further writes until the fault is resolved) or consistency (i.e. potentially return unacknowledged/stale data from one of the nodes until the fault is resolved).
While returning unacknowledged/stale data is acceptable for some usecases, it does break ACID semantics. You can't get both ACID and "always-on" availability with a simple replication scheme like this.
If you want linearizability and HA, you need at least three servers and a more complex, quorum-based scheme. However, Postgres doesn't support that (AFAIK) - you have to use something like Zookeeper or CockroachDB. I think this is what zzzcpan meant.
(I realize that you only spoke about never loosing a write and didn't say anything about updates/queries. If you don't care about ACID, postgres with synchronous replication is a good highly available solution)
That aside why the hell do I want to thing of cockroaches day in and day out when I am using their product? Seriously, is this someone's idea of a bad joke?
The name has got to go.
Honestly there are companies with _much_ worse names in active use like "Dick & Daughters"[0] or "Ismail ANUS"[1] who even got an appointment to the queen.
Seriously, it's bikeshedding, and the point of the DB is that you don't think about it all day.
I also don't think of women called Cassandra when I use the database of the same name. Bikeshedding. Seriously.
[0] https://beta.companieshouse.gov.uk/company/08610385
[1] https://beta.companieshouse.gov.uk/officers/5-sFnEsibrDnUR2-...
Instead what I see in this thread is a clear consensus that the current name is atrocious, even to the point of being detrimental to the long-term success of the project, and should therefore be changed.
Personally, I refuse to use or recommend this product as long as its current name remains. And to those who think I'm being petty, 1) I can afford to be petty given how many database options (NoSQL or otherwise) are out there, and 2) market forces should punish products with names like this, or else we'll eventually find ourselves debating the merits of HerpesDB vs. ManureDB.
EDIT: Also, cockroaches are BUGS! Bugs cause problems in computer systems.
They're just hurting themselves for no good reason other than feeling good about their bad sense of humor most people don't sympathize with.
Imagine any IT department in a large company, when they're deciding which technology to use, this definitely matters. I mean, funny names like "mongodb" is alright, but the first image when people hear about "cockroachdb" is not a good picture. And first impression matters a lot. It's marketing 101.
--
Just think about real-life scenario of how you would recommend to a co-worker:
"Hey we should definitely use this new database. It's called couchdb!" vs "Hey we should definitely use this new database, it's called cockroachdb!"
Or,
"Hey we should check out this awesome way of representing API. It's called JSON-API!" vs "Hey we should check out this awesome way of representing API. It's called Swagger!"
Both depend on wall clocks.
First, to answer @sroussey - Kyle is correct, GUN is an eventually consistent graph database that runs browser/server with extremely high availability, while CockroachDB is trying to be a strongly consistent, linearizable key/value SQL store. To read about what we guarantee/don't, check out these articles:
https://github.com/amark/gun/wiki/CAP-Theorem
http://gun.js.org/distributed/matters.html (tech talk on how the algorithms work)
https://github.com/amark/gun/wiki/Conflict-Resolution-with-G...
The last year we've focused on performance, and can now do 25M+ reads/sec (no cache miss, disk I/O performance isn't particularly interesting to us). More on that here: https://github.com/amark/gun/wiki/100000-ops-sec-in-IE6-on-2... (we're not kidding about it being able to run in the browser)
With regards to commutative / non-commutative, @Aphyr, slight correction: Different machines will converge to the same value, it is just that you'd need to use a commutative CRDT on top of gun (we have one here: https://github.com/amark/gun/wiki/snippets-(v0.3.x)#counter ) for them to converge to their combined value.
Example: GUN treats primitives as atomic, so if you try to `gun.get('some').path('math').put(5 + 2)` it will converge to the atomic value of 7. So if two machines do `gun.get('some').path('math').put(currentValue + 2)` at the same time, both machines will converge to the fixed atomic value, not a commutative value - you need the CRDT for that.
I mention this in the "What could go wrong?" section of the talk (linked above), and it is easy to add the necessary CRDT when you need it - actually, this was inspired by you @aphyr, from our discussion a few years ago.
Note: @Aphyr, we built a distributed testing framework ( https://github.com/gundb/panic-server ), and now that our "performance improvement" stage is done, in the near future we're going to start building distributed correctness tests (we're rolling out to a government client soon). We'll probably be in touch with you in the next half year or so. :)
Great work, keep it up. You are always a huge inspiration. <3
Edit: With regards to sharding / SQL, we don't have SQL support yet but somebody is currently building a prototype for it. Sharding, not built in, but peers store the data they request, which acts as a natural shard, but nothing fancy - for more info check out this article: https://github.com/amark/gun/wiki/sharding .
How about Duradero ... Spanish for durable. The name doesn't seem to be taken by any other database type software
CockroachDB accurately and immediately conveys meaning. It'll survive when nuclear war happens just like a cockroach. And I might work in the games industry but I would never have a hard time selling this. I would basically force them to use it and explain the benefits.
If your company wont adopt technology because it uses a bug as it's name then your company has much greater problems than technology adoption.
Average project, some 60 year old VP signing off on 100k of custom software with 8 pages of lawyer speak contracts is NOT going to allow "his" project to run off of "cockroach database". VP's/CEO's like to take personal ownership of projects they feel will go well, and ones done with us usually do. None of these people want ANY chance of their project getting criticized internally, so nobody will use CockroachDb. It's just not going to happen. Having successful projects is an easy way for these people to gather promotions and respect. Having any part of it do with "cockroach" could result in the whole project being an embarrassment.
Imagine the database goes down one day. One of their low level staff calls us(we have ongoing support contract). Problem gets rapidly escalated to development. One of our lead developers replies to the email thread, that by now has a third of the clients' company on it. "Yeah see the problem was the cockroach database that wasn't supposed to go down needed to be restarted" . Most of the staff think we're joking. Guarantee this becomes a big pun around their office, every time anything breaks in the app they say "maybe the cockroaches on the back end died again".
It's made worse by the fact that issues in software systems are commonly called "bugs". Well, our system doesn't have general bugs anymore, it has "cockroaches". Do you think this is an unlikely scenario? Because it's not. Besides the word "cockroach" this is exactly how urgent issues tend to be reported and fixed. Replace "cockroach" with "Microsoft" and I've probably violated my NDA. After that incident, whoever championed the project, probably our strongest ally in the company, resents us for making such a stupid mistake that resulted in his project becoming a joke. Maybe we aren't as great of a dev shop as he once thought? Maybe it's better to do open bidding next time so whoever wins he can't be blamed directly for what happens.
You could say their company culture sucks, maybe it does? But that doesn't change that I can't use it on any client projects because of the chance we'll lose hundreds of thousands over a stupid name.
There's plenty of other names that convey meaning but don't make lawyers nervous. Your attitude of "oh, well if you can't use it your company culture sucks" is EXACTLY why nobody will rename it and why corporate american won't touch it. Nobody cares about how cool it is to be edgy when millions of dollars are on the line.
If you plan on forcing clients to use it you might as well hold a going away party for any of your clients with more than 5M revenue.
I wouldn't have a problem selling the technical merits of a highly consistent database to a technical director. So everything else is moot to me.
I agree about the "bug" association, that is a negative stigma that I could see attached to it- but there are plenty of projects who have stupid names which pass by unnoticed.
take distro release names; Beefy Miracle.. Wheezy.. Natty Narwahl.
And these terms are used internally too. "Oh, that machine was running Squeeze and not Jessie which is why we can't install the latest gdb" etc;
You're giving this much more credence than it will have in real life.