# The Principle of TiDB Lightning

__*The Lightning Principle*__
__*Lightning architecture*__

![left](./student-guide/diagram/TiDBLightningPI3_en_001_20220617.png)
-------------------------------------------------------------
tidb-lightning prepares an "engine file" for each block to handle key-value pairs. tidb-lightning read the SQL dump concurrently, converts the data source into key-value pairs with the same encoding as TiDB, and then writes the sorted key-value pairs to the local temporary storage file.