iozone:5个并发线程随机读取300K块比只使用一个线程做更多的操作,可能是什么原因?

该分区使用软件RAID在RAID1中。

Command line used: iozone -s 190g -r 300k -O -b test_file OPS Mode. Output is in operations per second. random random bkwd record stride KB reclen write rewrite read reread read write read rewrite read fwrite frewrite fread freread 199229440 300 240 234 254 253 58 127 100 6539 91 234 234 254 254 

所以对于300K块,使用一个线程随机读取的速度是每秒58个操作数,约为17MB / s。

但是,当我尝试了5个线程,每个读取300K块,对我来说意外的是它运行得更快,但我期望更多的随机访问:

  OPS Mode. Output is in operations per second. Command line used: iozone -s 80g -r 300k -O -l5 -u 5 -F test_file1 test_file2 test_file3 test_file4 test_file5 Children see throughput for 5 random readers = 69.27 ops/sec Parent sees throughput for 5 random readers = 69.27 ops/sec Min throughput per process = 13.81 ops/sec Max throughput per process = 13.89 ops/sec Avg throughput per process = 13.85 ops/sec 

有谁知道在Linux操作系统或硬盘驱动器中读取/caching策略是什么使5个线程读取随机300K块比1个线程读取随机300K块快?

什么是令人惊讶的?

1个线程表示命令,等待,读取,循环。 有一个等待元素 – 延迟。

multithreading消除了这一点,并且 – 由于多个命令的排队,允许光盘更加优化。 你用3个线程获得更多的IOPS根本不足为奇。

这是一个raid1,所以写入两个磁盘,但读取可以满足一个,所以更多的线程,我希望更好的性能。 但是,对于线程数量相当于raid 1中的磁盘数量(或者raid 10的raid 1部分)来说,这可能是最好的select。