Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.
Original topic: mysql5.7.27单实例与tidb性能压测对比
Problem description:
mysql5.7.27:
sysbench oltp_read_write.lua --mysql-host=192.168.201.1 --mysql-port=3306 --mysql-db=sbtest --mysql-user=yanfa --mysql-password=12345678 --table_size=5000000 --tables=10 --threads=10 --time=60 --report-interval=10 prepare
When preparing data in the prepare phase for a single MySQL instance, the single instance of MySQL can complete it very quickly.
tidb-v5.3.0: (3 PDs, 1 TiDB, 3 TiKV)
sysbench oltp_read_write.lua --mysql-host=192.168.201.1 --mysql-port=4000 --mysql-db=sbtest --mysql-user=root --mysql-password=‘’ --table_size=5000000 --tables=10 --threads=10 --time=60 --report-interval=10 prepare
In the data preparation phase, a single MySQL instance can prepare the data very quickly (in less than 20 minutes), while the TiDB preparation phase takes nearly 5 hours. The device running the single instance of MySQL is one of the PD machines, with a memory configuration of only 1G, the same size as TiDB’s memory.
I don’t understand why there is such a big difference?
Have you done any tuning according to the official documentation?
TiDB is used to solve problems that MySQL cannot solve with money.
No, based on what you sent, I’ll make some adjustments and see the results.
Are you running it on a virtual machine?
Refer to the machine configuration and data volume in TiDB Sysbench 性能对比测试报告 - v6.1.0 对比 v6.0.0 | PingCAP 文档中心 to compare and test.
This kind of comparison, distributed vs. single-machine, involves different application scenarios. Personally, I feel there’s no basis for comparison.
The machine configuration is the same, the allocated resources are the same, and the application scenarios are also the same. Without comparison, there is no contrast. I work with MySQL, and if I want to use TiDB, I have to compare it with MySQL.
You are simply comparing different versions of TiDB. I want to compare it with a single-instance MySQL to see which one performs better, ensuring that resources and scenarios remain basically the same for the comparison.
TiDB is also a type of database. If you’re willing to spend money on MySQL, problems can be solved as well, it’s just a matter of splitting it into more sets. Currently, TiDB’s market share is still not comparable to MySQL. TiDB has its advantages, but it also has its disadvantages. MySQL has its advantages and disadvantages as well.
I don’t even know where to start complaining. Running TiDB with just 1GB of memory? You might as well stick to MySQL; I suggest comparing it with PostgreSQL instead. 
Is the server configured with 1G?
TiDB has many components and is a behemoth; 1G isn’t even enough to fill the gaps between its teeth. 
I think it’s fine to make comparisons, but the context should be considered. Comparing such extreme cases doesn’t hold much significance.
Compare it again under 200 million large data volume in MySQL.
You might not be answering this correctly.
Comparing distributed systems and single-node systems while ensuring consistent resources is essentially a fallacy. In most cases, TiDB’s latency is higher than that of single-node MySQL, which is certain. The purpose of designing TiDB was not to compare it with single-node MySQL.
TiDB is quite resource-intensive, so this test is not very meaningful. Given my data volume, TiDB has a significant advantage over a single machine.
One is a solo effort, the other emphasizes teamwork. How can you compare them?
I can only say that the application scenarios are different.
The write performance of a standalone MySQL is definitely better than TiDB.
Test environment, as long as it works.