1、写速度测试
用dd命令进行测试,以每次写入8k的数据,执行300000次,time命令显示执行过程的时间,执行完成后生成/test.disk文件,大小为2.3G,下面是两台物理服务器和一台虚拟机的写入速度对比:
物理机1:10.0.0.11
linux-t10u:~ # time dd if=/dev/zero of=/test.disk bs=8k count=300000 300000+0 records in 300000+0 records out 2457600000 bytes (2.5 GB) copied, 2.07894 s, 1.2 GB/s # 每秒写入1.2G real 0m2.081s user 0m0.032s sys 0m1.112s linux-t10u:~ # du -sh /test.disk 2.3G /test.disk # 执行完后生成的文件 |
物理机2:10.0.0.12
linux-rnqg:~ # time dd if=/dev/zero of=/test.disk bs=8k count=300000 300000+0 records in 300000+0 records out 2457600000 bytes (2.5 GB) copied, 3.03114 s, 811 MB/s # 每秒写入811MB real 0m3.032s user 0m0.052s sys 0m1.504s linux-rnqg:~ # du -sh /test.disk 2.3G /test.disk # 执行完后生成的文件 |
VMWare虚拟机:
hm:~ # time dd if=/dev/zero of=/test.disk bs=8k count=300000 300000+0 records in 300000+0 records out 2457600000 bytes (2.5 GB) copied, 37.0812 s, 66.3 MB/s # 每秒写入66.3MB real 0m37.094s user 0m0.288s sys 0m33.174s hm:~ # du -sh /test.disk 2.3G /test.disk |
2、读取速度测试
使用dd命令读取/test.disk文件
物理机1:10.0.0.11
linux-t10u:~ # time dd if=/test.disk of=/dev/null bs=8k 300000+0 records in 300000+0 records out 2457600000 bytes (2.5 GB) copied, 0.398211 s, 6.2 GB/s real 0m0.400s user 0m0.016s sys 0m0.380s |
物理机2:10.0.0.12
linux-rnqg:~ # time dd if=/test.disk of=/dev/null bs=8k 300000+0 records in 300000+0 records out 2457600000 bytes (2.5 GB) copied, 0.813786 s, 3.0 GB/s real 0m0.815s user 0m0.032s sys 0m0.500s |
VMWare虚拟机:
hm:~ # time dd if=/test.disk of=/dev/null bs=8k 300000+0 records in 300000+0 records out 2457600000 bytes (2.5 GB) copied, 29.2684 s, 84.0 MB/s real 0m29.296s user 0m0.068s sys 0m14.401s |
3、读取和写入测试
用刚刚在上面测试写速度生成的大小为2.3G的test.disk文件,将其拷贝为/tmp/test.disk2文件,测试磁盘读取和写入的速度
物理机1:10.0.0.11
linux-t10u:~ # time dd if=/test.disk of=/tmp/test.disk2 bs=8k 300000+0 records in 300000+0 records out 2457600000 bytes (2.5 GB) copied, 2.42679 s, 1.0 GB/s # 读取写入速度 real 0m2.428s user 0m0.012s sys 0m1.352s linux-t10u:~ # du -sh /tmp/test.disk2 2.3G /tmp/test.disk2 |
物理机2:10.0.0.12
linux-rnqg:~ # time dd if=/test.disk of=/tmp/test.disk2 bs=8k 300000+0 records in 300000+0 records out 2457600000 bytes (2.5 GB) copied, 3.52278 s, 698 MB/s # 读取写入速度 real 0m3.524s user 0m0.052s sys 0m1.972s linux-rnqg:~ # du -sh /tmp/test.disk2 2.3G /tmp/test.disk2 |
VMWare虚拟机:
hm:~ # time dd if=/test.disk of=/tmp/test.disk2 bs=8k 300000+0 records in 300000+0 records out 2457600000 bytes (2.5 GB) copied, 70.0314 s, 35.1 MB/s # 读取写入速度 real 1m10.098s user 0m0.124s sys 0m16.901s hm:~ # du -sh /tmp/test.disk2 2.3G /tmp/test.disk2 |
3、使用hdparm工具测试磁盘的读取速度
物理机1:10.0.0.11:
linux-t10u:~ # hdparm -Tt /dev/sda /dev/sda: Timing cached reads: 24714 MB in 2.00 seconds = 12368.87 MB/sec Timing buffered disk reads: 1904 MB in 3.00 seconds = 634.53 MB/sec 测试结果:2秒钟读取了24714 MB(缓存读)的数据,每秒的速度12368.87 MB/sec 3秒钟读取了1904 MB (物理读)的数据,每秒的速度634.53 MB/sec |
物理机2:10.0.0.12:
linux-rnqg:~ # hdparm -Tt /dev/sda /dev/sda: Timing cached reads: 20446 MB in 2.00 seconds = 10233.63 MB/sec Timing buffered disk reads: 1918 MB in 3.00 seconds = 638.88 MB/sec |
VMWare虚拟机:
hm:~ # hdparm -Tt /dev/sda /dev/sda: Timing cached reads: 10748 MB in 1.99 seconds = 5388.49 MB/sec Timing buffered disk reads: 1974 MB in 3.00 seconds = 657.30 MB/sec |
本文出自 “7414593” 博客,请务必保留此出处http://7424593.blog.51cto.com/7414593/1841883