Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.
Original topic: 机械硬盘对tidb数据库的查询性能影响大吗?
[Test Environment for TiDB]
Deployed TiDB on the server, and found that the query speed is much slower compared to the virtual machine, even though the server’s configuration is much higher than the virtual machine. Therefore, I am considering whether it is a hard disk issue, as the server uses a mechanical hard drive while the virtual machine uses an SSD.
Running PD and TiKV on mechanical drives will have a significant impact. Check the server hardware configuration requirements: TiDB 软件和硬件环境建议配置 | PingCAP 文档中心
You can test disk performance in two environments with the following commands:
IOPS test reference command
fio -group_reporting -thread -name=iops_test -rw=randwrite -direct=1 -size=8G -numjobs=8 -ioengine=psync -bs=4k -ramp_time=10 -randseed=0 -runtime=60 -time_based
Read/write bandwidth test reference commands
fio -group_reporting -thread -name=iops_test -rw=randwrite -direct=1 -size=8G -numjobs=8 -ioengine=psync -bs=1m -ramp_time=10 -randseed=0 -runtime=60 -time_based
fio -group_reporting -thread -name=iops_test -rw=randread -direct=1 -size=8G -numjobs=8 -ioengine=psync -bs=1m -ramp_time=10 -randseed=0 -runtime=60 -time_based
Slowness is not necessarily a disk issue. Test with fio on both physical and virtual machines and then take another look.
The gap is significant; the bottleneck for mechanical drives is usually the disk itself.
Databases definitely have high demands on disks… Any database does.
Sure, here is the translation:
“Take a look at this
https://zhuanlan.zhihu.com/p/260384319”
Databases have high demands on disks, mechanical drives are running hot.
Command Reference for Running IOPS Test
This is the server:
This is the virtual machine:
Command Reference for Running Read/Write Bandwidth Test
This is the server:
This is the virtual machine:
The IOPS test difference doesn’t seem significant, but the read/write difference appears quite large.
I didn’t see the first IOPS result in the screenshot.
The IOPS result is in the place of my screenshot.
Oh, I see.
This is the server’s:
This is the virtual machine’s:
IOPS are only a few thousand, which makes it very difficult for this type of disk to run a database. NVMe SSDs are not expensive nowadays, so I recommend switching to SSDs.
Is it that high? Why does my virtual machine only have a few thousand IOPS? My computer uses an NVMe SSD.
The impact is significant.
There is no performance to speak of; the IOPS of a mechanical disk is only a few dozen, while even a poor SSD has a few thousand. Use a mechanical disk to install Oracle.
Very large, go for NVMe SSD.