72 points · by philonoist · 1y ago · 65 comments
1. SQL front end nodes 2. Distributed shared nothing storage (TiKV) 3. Meta data server (PS) 4. TiFlash column store
1 and 3 are written in Go 2 is written in Rust and uses RocksDB 4 is written in C++
2 & 3 are graduated CNCF projects maintained by PingCAP.
Disclaimer: I work for PingCAP
TiDB is Apache licensed, that should be enough no? Because if we ban all projects from VC-backed startups, you're going to clear your tech stack pretty quickly.
I think the best way would be something similar to the Linux Foundation. Companies in need of a certain type of database would pool resources to develop and maintain it.
PostgreSQL was a community developed database that was funded in something approaching this way as most of the developers were either students or worked for someone who paid them while they worked on it.
> TiDB is Apache licensed, that should be enough no?
It's good enough to use it with the knowledge that it isn't truly free (libre) because the CLA gives the owning company the right to change that at any time. So you can use it but don't build a business around it or make it a critical part of your infrastructure as they might pull the rug out from under you.
Disclaimer: I currently work at PingCAP and previously worked at the Linux Foundation.
Foundation (whether it's the LF or others) isn't a panacea either. It's fine when projects get started and there are plenty of willing member companies, but for many projects, companies often lose interest, need to cut down on open source related investments, etc. and the project funding dwindles. The reality is that the member companies need to both fund and provide software developers for projects, and it's difficult to expect them to keep the same commitment for more than a few years these days....
It isn't copyleft, so even without a CLA, they could make a proprietary or open core version of the product, as can anyone else.
I'm afraid that they can always do that with or without a CLA. Apache is quite a permissive license.
A popular more lightweight solution is the DCO[0].
A side aspect of this is that they also destroy any motivation for developing free software other than as a marketing tool, a way to drive growth. While that is perfectly fine for companies to do this, it has long term consequences that lead to bad behavior that mean you should be extra wary of relying on them.
My fear is companies without in-house RDBMS expertise see these products as a way to continue to avoid getting that expertise.
a distributed database is potentially more complicated to operate, and optimize, and because its new and potentially has more sharp edges maybe less reliable (?) but the extraction of moderate sized datasets doesn't really seem to be an obvious failing.
People who bang on about Postgres replication have rarely setup replication in Postgres themselves and that too in the 100a of Pb scale.
MySQL replication works well and can be scaled more easily (relative to Postgres) but has its own problems. eg., DDL is still a nightmare, lag is a real problem, usually masked by async replication. But then eventual consistency makes the application developers life more complicated.
https://jepsen.io/analyses/tidb-2.1.7
The devil is in the details, and anyone who is looking to implement TiDB for data correctness should read through not just this but other currently-open correctness-related Github issues:
e.g., https://github.com/pingcap/tidb/issues?q=is%3Aissue%20state%...
TiDB currently has 74 open issues related to "correctness," and has closed 163.
I have strong doubts about distributed DBs in general, but I also can’t see them blatantly lying in a talk.
I think people’s idea of scale and operating at scale is limited to their experience.
You can get MySQL to run at any scale, look at Meta and Shopify. Operational complexity at that scale is a different story.
Distributed databases reduce a lot of the operational complexity. To take one example:
Try a DDL on a 5 TB table in any replicated MySQL topology of choice and compare it with TiDB’s Distributed execution framework.
In the previous event (2023) there were speakers from Airbnb, Databricks, Flipkart, PayPay, and others sharing their experiences as well - https://www.pingcap.com/htap-summit/sept-2023/
Disclosure: Employee of PingCAP the company behind TiDB
Wasn't last year 2024?
Reference: https://docs.pingcap.com/tidb-in-kubernetes/stable/get-start...
(Also, bold move to write a db without fully being able to manage memory).
> Distributed Transactions: TiDB uses a two-phase commit protocol to ensure ACID compliance, providing strong consistency. Transactions span multiple nodes, and TiDB's distributed nature ensures data correctness even in the presence of network partitions or node failures.
> High Availability: Built-in Raft consensus protocol ensures reliability and automated failover. Data is stored in multiple replicas, and transactions are committed only after writing to the majority of replicas, guaranteeing strong consistency and availability, even if some replicas fail. Geographic placement of replicas can be configured for different disaster tolerance levels.
See https://github.com/pingcap/tidb?tab=readme-ov-file#key-featu...
Correctness has been a focus for a long time for TiDB, including working on passing Jepsen Tests back in 2019, see https://www.pingcap.com/blog/tidb-passes-jepsen-test-for-sna... and https://jepsen.io/analyses/tidb-2.1.7
Disclosure: Employee of PingCAP the company behind TiDB
The first paragraph I find under Key Features is:
Distributed Transactions: TiDB uses a two-phase commit protocol to ensure ACID compliance, providing strong consistency. Transactions span multiple nodes, and TiDB's distributed nature ensures data correctness even in the presence of network partitions or node failures.
It claims to ensure correctness in the presence of partitions, not availability, so I don't think that's a claim that CAP is wrong? I would expect it to be unavailable if it can't provide a consistent response.
I don't know about memory management. It seems go may not be used for the storage layer, but in any case, it wouldn't be the first attempt at a DB on a garbage collected runtime. I can think of at least Cassandra on the jvm and CockroachDB also on Go. I do prefer that DBs do their own memory management (as well as storage) but this is not as unique as it used to be though.
Additionally, it can push down the DAG to the TiKV storage nodes, written in Rust, to reduce movement of data and work closer to the physical data.