Performance Benchmark Comparison Between MySQL 5.7.27 Single Instance and TiDB

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: mysql5.7.27单实例与tidb性能压测对比

| username: yulei7633

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?

| username: 啦啦啦啦啦 | Original post link

Have you done any tuning according to the official documentation?

| username: TiDBer_o1d3CXiP | Original post link

TiDB is used to solve problems that MySQL cannot solve with money.

| username: yulei7633 | Original post link

No, based on what you sent, I’ll make some adjustments and see the results.

| username: tidb菜鸟一只 | Original post link

Are you running it on a virtual machine?

| username: yiduoyunQ | Original post link

Refer to the machine configuration and data volume in TiDB Sysbench 性能对比测试报告 - v6.1.0 对比 v6.0.0 | PingCAP 文档中心 to compare and test.

| username: 裤衩儿飞上天 | Original post link

This kind of comparison, distributed vs. single-machine, involves different application scenarios. Personally, I feel there’s no basis for comparison.

| username: yulei7633 | Original post link

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.

| username: yulei7633 | Original post link

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.

| username: yulei7633 | Original post link

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.

| username: 托马斯滑板鞋 | Original post link

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. :rofl:

| username: 我是咖啡哥 | Original post link

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. :joy:

| username: 我是咖啡哥 | Original post link

I think it’s fine to make comparisons, but the context should be considered. Comparing such extreme cases doesn’t hold much significance.

| username: liuis | Original post link

Compare it again under 200 million large data volume in MySQL.

| username: BraveChen | Original post link

You might not be answering this correctly.

| username: hey-hoho | Original post link

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.

| username: xingzhenxiang | Original post link

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.

| username: Kongdom | Original post link

:thinking: One is a solo effort, the other emphasizes teamwork. How can you compare them?
I can only say that the application scenarios are different.

| username: TiDBer_pkQ5q1l0 | Original post link

The write performance of a standalone MySQL is definitely better than TiDB.

| username: yulei7633 | Original post link

Test environment, as long as it works.