# Tikv Architecture Overview
+ Persistence of data
+ Distributed consistency
+ MVCC
+ Distributed transaction
+ Coprocessor

![left](./student-guide/diagram/03-structure-01-01.png)
------------------------------------------------------------
In the previous lesson, we learned that TiDB Server is a SQL layer that exposes the connection endpoint of the MySQL protocol to the outside world, is responsible for accepting client connections, executing SQL parse and optimization, and finally generating distributed execution plans. TiDB Server itself is stateless.

Next, we will introduce TiKV, the main core function of TiKV is responsible for data persistence of TiDB database, this function is implement by RocksDB integrated in TiKV, so we will focus on RocksDB data write (that is, persistence) and read in TiKV, and also introduce RocksDB Column Families feature, which has a significant impact on later transaction and MVCC support.

Another feature of TiKV is support for distributed transactions and MVCC, so we will introduce their implement from the TiKV level.

In the TiDB database, TiKV is a distributed storage engine, and the data is stored distributed in regions, so we used the raft consensus algorithm to achieve strong consistency of data in distributed environments. Each region and its replica forms a raft group, and the combination of multiple raft groups is called a multi raft. We will introduce you to the replication and leader elect in Raft, as well as data writing, read, splitting, and merging based on the Raft consensus algorithm. The write/read based on the raft consensus algorithm is different from the previously mentioned RocksDB write and read, RocksDB write and read mainly refers to the guarantee of data persistence and consistency reading on a single TiKV node, is vertical, and write/read based on raft consensus algorithm is mainly for multiple The operation of a cluster of TiKV nodes can be considered horizontal.

Later, we introduced the Coprocessor function component, which provides the ability to push down the operator for TiKV. We can use this function component to hand over some SQL calculations such as filtering, aggregation, and projection to TiKV to complete it, without sending all the data in TiKV to TiDB Server over the network, and there is no need to send all the data in TiKV to TiDB Server. It is necessary to send all the computation pressure to the TiDB server. This saves network bandwidth and the CPU load of the TiDB Server.