# Using TiDB Lightning - Hardware Requirements

__*Using Lightning*__
__*Lightning hardware requirements*__

+ Separate deployment recommended
+ Recommended CPU, memory
  + In local-backend mode: 32-core or greater CPU + 64 GB of memory
  + TiDB TIDB-backend mode: 4 or more cores CPU + 8 GB of memory
+ Exclusive IO and high performance storage media such as flash are recommended
+ Recommended network bandwidth greater than or equal to 10 Gbps

-------------------------------------------------------------
Operating systems: The examples in this document use several new, clean CentOS 7 instances where you can virtualize a host locally or deploy a small cloud virtual host on a vendor-provided platform. When TiDB Lightning is running, it will fill up the CPU by default, so it is recommended to deploy it on a separate host. If the condition does not allow, you can deploy TiDB Lightning and other components (such as tikv-server) on the same machine, and then set the value of the region-concurrency configuration item to 75% of the logical CPU count to limit the TiDB Lightning pair The use of CPU resources.

Memory and CPU:
TiDB Lightning has different CPU and memory requirements in different backend modes. When deploying, it is recommended to select the appropriate environment according to the backend used to obtain the best import performance.
Local-backend: This mode requires high CPU and memory requirements. It is recommended to allocate more than 32 cores of CPU and 64 GiB of memory for TiDB Lightning.

Instructions:
When importing large amounts of data, one concurrency consumes about 2 GiB of memory for one concurrency, which means that the total memory usage can reach up to region-concurrency * 2 GiB. The region-concurrency defaults to the same number of logical CPU. If the memory size (GiB) is less than twice the number of logical CPU or if OOM occurs at runtime, you need to manually lower the region-concurrency parameter to avoid the TiDB Lightning OOM.
TiDB-Backend: The main performance bottleneck for this mode is TiDB, and it is recommended to allocate a 4-core CPU and 8GB of memory. If you find that the TiDB cluster does not reach the write limit during the actual import, you can increase the region-concurrency configuration parameter appropriately.
Importer-backend: Resource consumption is basically the same as local-backend. It is not recommended to use. If there are no special requirements, use local-backend first.
Storage space: The configuration item sorted-kv-dir sets the temporary storage address of the sorted key-value pairs. The target path must be an empty directory, and the directory space must be larger than the size of the dataset to be imported. It is recommended to use a different storage device than data-source-dir. Exclusive IO provides better import performance, and it is recommended to prioritize high-performance storage media such as flash.

Network: A network card with a bandwidth >=10Gbps is recommended.