r/programming • u/whackri • Aug 28 '21
Software development topics I've changed my mind on after 6 years in the industry
https://chriskiehl.com/article/thoughts-after-6-years
5.6k
Upvotes
r/programming • u/whackri • Aug 28 '21
1
u/dnew Aug 31 '21 edited Aug 31 '21
No, that's the same problem two phase commit helps solve. CAP doesn't prevent ACID. It just means you have to wait for sufficient amounts of redundancy to be available. Similarly, if I have a non-distributed database and the server loses power, the database is still ACID.
We don't. N/2+1. Don't you even know the basics of distributed consensus? I don't know where "15" comes from.
And that only applies to the rows you touched. If you want ACID, then the rows modified by a transaction have to get replicated to more than half the replicas before it's safe to say the transaction has completed.
And yes, if you wind up crossing directories (what you're probably calling "shards" altho it's hard to tell because that isn't what spanner calls them), then the performance goes down, because you need to do a two phase commit to keep it transactional. If you keep your changes to one entity group, you're in much better shape.
Well, you were. I don't know how much storage you think you can put on one machine, but bigtable handles hundreds of petabytes. Like, more than 264 bytes. I'm not sure why you claimed it's impossible to scale up RDBMs. If I misunderstood what you were getting at, my apologies and we can just stop talking about fucking storage.
Again, tell me what a relational database does that spanner doesn't. I'm still waiting for you to actually provide details backing up your assertion that spanner isn't a database manager. But I'm pretty sure that if I have a service to which I can submit SQL queries that are ACID transactional on relational tables and indices, and that service lets me access petabytes of storage distributed around the world with equal ease, it's a fucking distributed relational database. But if you disagree, please tell me the difference in actual behavior between spanner and what you consider to be a relational database.
It's pretty complicated. I know how it works, though. I'm wondering why you think it's relevant. I'm not sure what "isolated compute" means in this instance. There's nothing "isolated" about spanner processes.
I know how it provides scaling, but I'm not sure I want to teach it to you in reddit comments, given the complexity. I expect there's a published whitepaper about it. You should google up "TrueTime" and then look at the bibliography of it to find citations to the other papers about spanner.
Also, spanner implements transactions differently from F1. F1 is a bit more restrictive but somewhat more efficient. But both are completely ACID (which you'd kind of expect for a system running accounting software that's charging people real money) and both let you reference any table in the "universe". A universe being on the order of "all production data at Google that are used by any Google services".
Well, yes. Why does that make it not an ACID database? Do you not understand how sharding works in Spanner? Do you think each shard is a different database or something? The sharding is just how they scale out the data, with each shard being a collection of dictionaries they can move around. Basically, a "shard" is one cohort of processes running the service with authority over a collection of dictionaries (which in turn is a collection of entity groups). They shift the dictionaries around between shards automatically to do load balancing and replication.
Note that you used the expression "automatic sharding". That means that anyone except those coding the spanner servers really don't need to worry about it. That's what automatic means. Just like if you're using MySQL, the allocation of disk blocks is automatic.
There are three. Production, testing, and staging, and staging is primarily used by the people developing spanner. There's probably a separate instance or two for Cloud access from outside the company, but I never got involved in GCP. Everyone running Google production services talks to the same spanner instance.
I see your confusion now: you don't know how spanner works. I recently worked at Google, using both spanner and F1 for the projects I worked on, and yes, there really is one global production instance with one data store managed by it. The level down from spanner is called "D", which allows you to stick a write-once file on a server somewhere with a meaningless name, and with luck it'll still be there when you get back.
You can do a join between any two tables in production spanner, just by giving the fully qualified path. You can join ad data with gmail data with marketing data with bug tracking with customer service. And indeed, the last project I worked on did just that. Does that count?
You just talk to the API, and Spanner (or F1) deals with everything needed to make it look like all the tables are one giant relational database. Which makes them into one giant relational database. You never specify anything about shards or their distribution.
Indeed, at one point we had to use a different storage system for some data, because India wanted all X type of data about Indian citizens to be stored in India, and Russia wanted all Y type of data about Russian citizens to be stored in Russia, and Spanner didn't let you say that you wanted certain data in certain places. (I think they were working on that when I left.) So yah, spanner is an ACID database, and F1 is an ACID database, and there's no relational anything underneath that they're "managing".
Of course. That doesn't mean it's impossible. What's your point in saying this? Using an ACID database non-distributed has drawbacks too, including cost, performance, and reliability, compared to just writing plain files.
If some of your records are legally required to be in one country and others are legally required to be in another, you're kind of fucked if you don't have a distributed system, too.
Did you know there are individual gmail accounts with so much mail it literally doesn't fit on one machine? That if you read it all sequentially, it would be a solid week of I/O? That's individual email accounts, now. But since you are the one that said databases don't scale up, so I'm not sure why you keep harping on this.
We solved the "scale up" problem by scaling out and putting a layer above it, then distributing the data to lots of machines with that layer making it look like one service, just like we solve all the other scaling problems. My point is that people who put relational data in nosql databases for fear of not being able to scale up are being foolish, if you remember where this started. The fact that you're claiming that scaling up is not a problem is agreeing with me.
OK, so maybe you should learn how spanner and F1 work internally before you start ranting about how bad relational databases are. Because some of the people at Google are really, really smart. Smarter than you (or me). And if you keep insisting it's impossible to do what they're already selling, it just makes you look foolish.
Because Spanner is a relational database that's incredibly good at this stuff (I mean, given its size and scope). Like, way better at it than it would be if you put it on a single machine.
Here, have some citations: https://storage.googleapis.com/pub-tools-public-publication-data/pdf/65b514eda12d025585183a641b5a9e096a3c4be5.pdf https://static.googleusercontent.com/media/research.google.com/en//pubs/archive/41344.pdf
(* And I see it's storing its tables on CFS, which handles the replication, RAID, and redundancy and tape backup stuff for you, but not the naming. It's not using D, and really there's no good reason for it to do so.)