# TiFlash's Architecture

![`smart`](TiFlashArchitecture_aa_002_20220516.png)
-------------------------------------------------------------
TiFlash is a key component of TiDB HTAP capability, which is a columnar extension of TiKV. It provides good isolation while taking into account strong consistency. Columnar replicas are asynchronously replicated through the Raft Learner protocol, but when reading, the Snapshot Isolation consistency isolation level is obtained through the Raft verification index combined with MVCC. This architecture solves the isolation and columnar synchronization problems in HTAP scenarios very well.

TiFlash provides columnar storage, and has an efficient Coprocessor. Besides, it is very similar to TiKV, relying on the same Multi-Raft system, replicating and distributing data in units of Region.

TiFlash replicates data in TiKV clusters in a lightweight and non-blocking way for write, and like TiKV, it also provides consistent read, that is, TiFlash can guarantee to read the latest data. The Region replicas in TiFlash correspond to those in TiKV completely, and will split and merge with the Leader replicas in TiKV simultaneously.

TiFlash recommends using different nodes from TiKV to achieve workload isolation. However, when we do not need business isolation, TiFlash is also possible to deploy on the same node as TiKV.

TiFlash cannot directly accept data writing other than TiKV, any data must be written to TiKV first and then synchronized to TiFlash. TiFlash joins the TiDB cluster as a Raft Learner role, TiFlash supports table-level data synchronization.

Note that TiFlash replication feature is by default turned off, you need to enable it manually.

Below is a summary:
1. TiFlash cannot handle high concurrency, generally QPS cannot be higher than 50.
2. The Region of TiFlash is completely consistent with TiKV, and the partitions are consistent.
3. TiFlash is suitable for scenarios where the whole table or most of the data in the table must be retrieved and read.
4. The point of TiFlash helping to improve query performance lies in column storage, aggregation operations, and Join operations.