TiKV
TiKV is a distributed key-value database that splits ordered keys across a cluster and replicates each range. It gives applications a durable storage layer with raw key-value access or distributed transactions.
itCloud native tools and technologies | OpenSkills.info
Course pathWalk it in order
Look it upDip in anytime
Go furtherLeaves this page
Don't Panic
Don't Panic — TiKV
TiKV is a database for keeping an ordered collection of byte keys and values on several machines without asking the application to memorize where each key moved to this morning. That last part is doing a remarkable amount of work. A single machine can keep an ordered map without convening a committee. A cluster must decide where each part lives, which copy speaks first, and when a write counts as real.
TiKV handles this by cutting one key space into Regions: consecutive ranges of keys. Each Region has several copies, called peers. The peers form a Raft group, and one peer is the leader. A write visits that leader, becomes a Raft log entry, and is committed when a majority agrees. This is less like putting copies in a filing cabinet and more like having the filing cabinet insist on a quorum before it changes a label.
PD, short for Placement Driver, keeps the wider map. It knows about Stores, Regions, leaders, capacity, and topology. Raft keeps one Region's replicas consistent; PD decides how many Regions should be where. That distinction is the useful bit. A system can have correct replicas in each small group and still need help distributing leaders, making room on a new Store, or avoiding a crowded part of the cluster.
The first surprise is that adding a Store also creates work. PD moves Regions and leaders toward the new layout, and those moves consume disk, network, and CPU. Replication also does not turn every network partition into a writable party. A quorum is a majority, so the minority side stops accepting safe writes. Backups and restore tests remain necessary, because no amount of orderly agreement recreates data you never recovered.
TiKV offers two ways to speak to the data. RawKV is direct key-value access with single-key atomicity. TxnKV adds multi-key ACID transactions and MVCC, which lets a transaction read a consistent snapshot and detects conflicting updates when it commits. The important decision is not which acronym sounds more expensive. It is whether several keys must change together. Separate RawKV operations do not become a transaction by wishing very earnestly.
Continue with the Intro for the architecture and the limits that follow from quorum. The Slides make the write path and the TiDB relationship visible at a glance. The Cheatsheet is the compact map for Regions, PD, Raft, RawKV, TxnKV, and monitoring signals. Field Notes covers the production judgments that hide behind the tidy diagram: hot keys, Region count, rebalancing, transaction retries, and Raftstore pressure.
Where this skill leads
Relevant careers
See how this topic contributes to broader role-level skill maps.
Sources
- https://tikv.org/
Supports
- TiKV as an open-source distributed transactional key-value store
- Official documentation and project scope
- https://tikv.org/docs/dev/reference/architecture/introduction/
Supports
- Official architecture study path
- Storage, scheduling, terminology, and deeper design coverage
- https://tikv.org/docs/3.0/concepts/architecture/
Supports
- RawKV and transactional API distinction
- TiKV, PD, Store, Region, Node, Raft, RocksDB, and TiDB relationships
- Single-key versus multi-key atomicity
- https://tikv.org/docs/dev/reference/architecture/storage/
Supports
- RocksDB local persistence
- Raft leader election, membership changes, log replication, and majority commit
- Ordered key ranges, Regions, Region distribution, and PD location metadata
- Distributed transaction model
- https://tikv.org/docs/dev/reference/architecture/terminology/
Supports
- Definitions of Node, Store, Region, peer, Raft, and PD
- Region split and merge behavior
- PD scheduling responsibilities
- https://tikv.org/docs/dev/reference/architecture/scheduling/
Supports
- PD as TiKV cluster manager and Region scheduler
- Replica placement, failure recovery, leader distribution, hot-load balancing, and new-store rebalancing
- Network, disk, and CPU cost of data movement
- https://tikv.org/docs/dev/concepts/explore-tikv-features/distributed-transaction/
Supports
- TxnKV distributed transaction behavior
- Snapshot isolation and concurrent update conflicts
- https://tikv.org/docs/7.1/develop/rawkv/introduction/
Supports
- RawKV as the non-transactional API
- Raw get, put, delete, scan, time to live, compare and swap, and checksum coverage
- https://tikv.org/docs/dev/concepts/explore-tikv-features/fault-tolerance/
Supports
- Failure and recovery behavior
- Quorum-based availability boundary
- https://tikv.org/docs/dev/deploy/monitor/key-metrics/
Supports
- Grafana and Prometheus monitoring context
- Storage, gRPC, scheduler, Raft, Region, MVCC, garbage collection, and coprocessor metrics
- https://tikv.org/deep-dive/
Supports
- Advanced study areas across consensus, key-value storage, transactions, scalability, RPC, scheduling, distributed SQL, and testing
- https://docs.pingcap.com/tidb/stable/tidb-architecture/
Supports
- TiDB server as the stateless SQL layer
- TiKV as row-oriented distributed transactional storage
- PD metadata, scheduling, and timestamp responsibilities
- TiFlash as columnar analytical storage
- https://github.com/sindresorhus/awesome
Supports
- Required starting point for curated Awesome-list discovery
- Discovery of database and big-data lists
- https://github.com/oxnr/awesome-bigdata
Supports
- Curated discovery of TiDB as a distributed SQL project related to TiKV
- https://github.com/operator-framework/awesome-operators
Supports
- Curated discovery of the official TiDB Operator
- https://docs.pingcap.com/tidb-in-kubernetes/stable/tidb-operator-overview/
Supports
- TiDB Operator management scope
- Kubernetes deployment, upgrades, scaling, backup, failover, and configuration changes
- https://github.com/tikv/tikv/blob/master/CHANGELOG.md
Supports
- Documented TiKV release history from 1.0 through later major release lines
- Region Merge, multi-threaded Raftstore, Titan, load-based Region splitting, and disk-space protection changes used in the timeline
- https://tikv.org/blog/tune-with-massive-regions-in-tikv/
Supports
- Operational effects of large Region counts on Raftstore
- Propose wait as an indicator of Raftstore contention
- https://tikv.org/blog/double-system-read-throughput/
Supports
- Region-leader read hotspots and their effect on throughput
- https://apple.github.io/foundationdb/architecture.html
Supports
- FoundationDB as an ordered transactional key-value alternative with a distinct architecture
- https://www.cockroachlabs.com/docs/stable/architecture/overview.html
Supports
- CockroachDB's replicated ranges and distributed SQL architecture
- https://docs.yugabyte.com/stable/architecture/transactions/distributed-txns/
Supports
- YugabyteDB distributed transactions across shards
- https://docs.cloud.google.com/spanner/docs/transactions
Supports
- Cloud Spanner transaction behavior and distributed transaction tradeoffs
- https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/transaction-apis.html
Supports
- DynamoDB transactional API availability for multi-item operations
