使用smb向内置硬盘写文件速度是106m,符合千兆网络的预期,但是向usb硬盘写文件速度只有25m,于是测试飞牛本机写usb硬盘的速度,然后发现正常写usb的速度就是不到30m,然后如果不通过系统缓存,直接io写usb硬盘则速度快的多,能到200m以上,aca@trim:/vol1/1000/soft$ dd if=/dev/zero of=./usb/final_test bs=1M count=512 status=progress
520093696 bytes (520 MB, 496 MiB) copied, 18 s, 28.9 MB/s
512+0 records in
512+0 records out
536870912 bytes (537 MB, 512 MiB) copied, 18.5693 s, 28.9 MB/s
上面是正常写
aca@trim:/vol1/1000/soft$ dd if=/dev/zero of=./usb/test_direct bs=1M count=512 oflag=direct status=progress
438304768 bytes (438 MB, 418 MiB) copied, 2 s, 219 MB/s
512+0 records in
512+0 records out
536870912 bytes (537 MB, 512 MiB) copied, 2.44735 s, 219 MB/s
这是使用oflag=direct 直接io写。
可是系统默认是通过缓存写,这个也不会修改啊。
aca@trim:/vol1/1000/soft$ dd if=/dev/zero of=/dev/shm/test bs=1M count=4096 status=progress
1642070016 bytes (1.6 GB, 1.5 GiB) copied, 3 s, 547 MB/s
dd: error writing '/dev/shm/test': No space left on device
1667+0 records in
1666+0 records out
1747615744 bytes (1.7 GB, 1.6 GiB) copied, 3.19743 s, 547 MB/s
直接写内存速度也没有问题