Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.
Original topic: 虚拟机的插入性能为什么那么低
[Test Environment for TiDB] Testing
[TiDB Version] 6.5.3
[Reproduction Path]
A self-built TiDB cluster on a virtual machine, simulating a production environment on a single machine.
tiup bench tpch --sf=1 prepare
Insert test data, then check the slow query in the dashboard:
It’s a batch insert statement, click to view details:
Although the machine is a bit trashy, it still uses an M2 interface, so it shouldn’t be this bad when inserting test data. The backoff is quite large. I checked other posts, and they said it’s due to lock conflicts, but at most, the insert should only be a hot block, right? And the key point is that only one program is running, so how can it still be locked?
Are there other processes running on the hard drive?
First, follow the official documentation to perform an fio test and see the results. The best outcome would be achieving SSD-level performance.
The performance is probably still insufficient.
The bucket effect depends on your overall configuration.
Virtual machines do indeed affect performance; it should be much better on a physical host.
TiDB is designed for HTAP application scenarios in massive data storage environments and has certain hardware requirements. If you are testing and verifying on a virtual machine, you should mainly focus on functionality. Performance will only be unlocked when certain conditions are met.
Run an fio test on a hard drive and take a look.
What are the specifications of your virtual environment? A single-node TiDB cannot outperform MySQL.
What is the hardware configuration of the virtual machine? What is the key network configuration?
Thank you all, it seems that the virtual disk is full. I created a new 40G disk and reran the bench, and it actually used 20G of space.
This raises a question: when the system disk is insufficient, will it cause the TiDB cluster efficiency to decline? From the above issue, it seems that this problem can indeed occur.
Check if the CPU virtualization feature is enabled, and using an SSD might improve performance.
Check the performance of the relevant disks.
The performance of a virtual machine is closely related to its hardware configuration.
In a virtual machine environment, performance is not a consideration.
The performance of a virtual machine depends on the configuration of its host machine. If the host machine uses NVMe drives, the performance should not be bad.
Insufficient disk, memory, and CPU will all affect the performance of the TiDB cluster.
When the system disk space is insufficient, no system can run. When we run out of space, even logging in is slow.