# Tidb Cluster Architecture

![left](./student-guide/diagram/01-TiDB-Architecture-01-01.png)
------------------------------------------------------------
- Through our previous study in the TiDB Administration-Establishment course, we have learned that the three key components of a TiDB database are PD Cluster, TiDB Server, and TiKV.
  
- The PD cluster is the control hub of the entire TiDB database, which is responsible for generating global TSO timestamps, scheduling the distribution of regions among TiKV nodes, collecting the health and distribution status of TiKV nodes, and generating global transaction IDs and unique IDs.

- No landing data is stored on the TiDB Server cluster, but it receives the SQL sent from the client, parse and compiles the SQL statements, and ultimately generates the execution plan. Finally, the TiDB Server executes these execution plans, accesses the data to the TiKV storage engine, and organizes the result set and return it to the client. Finally, DDL operations and recovery (GC) of old version data are also done by TiDB Server.

- The data is mainly stored in the form of key-value in the TiKV cluster, which is mainly responsible for data persistence, MVCC (multi-version concurrency control), coprocessor (pushing operators down to TiKV nodes), transaction and their own replica for high availability and strong consistency (implement by multi-raft mechanism), I'll cover it in detail in the TiKV course.

- Here, we have another component, TiFlash, a columnar storage engine, which mainly synchronizes data with TiKV through the scale raft consensus algorithm, realizes load balancing, strongly consistent read, and TiFlash supports real-time updates. In this way, analysis query service isolation is realized for OLTP scenarios, and query efficiency is greatly improved for OLAP scenarios.

- Below, we will introduce the main functions, implement principles and features of TiDB, TiKV and PD respectively in this module. In the “MODULE 3 TiDB Database HTAP Technology” later, we will introduce the implement principle and function of TiFlash.