
在遇到一些性能问题后,我使用以下脚本为磁盘读/写速度创建了一个简单的基准:
echo Write to diskdd if=/dev/zero of=test1 bs=1048576 count=2048echo Read from diskdd if=test1 of=/dev/null bs=1048576
这是一个示例输出:
[bizwayz@host perf]./benchmarkWrite to disk2048+0 records in2048+0 records out2147483648 bytes (2.1 GB) copIEd,11.2601 seconds,191 MB/sRead from disk2048+0 records in2048+0 records out2147483648 bytes (2.1 GB) copIEd,0.789302 seconds,2.7 GB/s[bizwayz@host perf]./benchmarkWrite to disk2048+0 records in2048+0 records out2147483648 bytes (2.1 GB) copIEd,3.69129 seconds,582 MB/sRead from disk2048+0 records in2048+0 records out2147483648 bytes (2.1 GB) copIEd,0.789897 seconds,9.56615 seconds,224 MB/sRead from disk2048+0 records in2048+0 records out2147483648 bytes (2.1 GB) copIEd,0.882664 seconds,2.4 GB/s[bizwayz@host perf]./benchmarkWrite to disk2048+0 records in2048+0 records out2147483648 bytes (2.1 GB) copIEd,3.52512 seconds,609 MB/sRead from disk2048+0 records in2048+0 records out2147483648 bytes (2.1 GB) copIEd,0.784007 seconds,2.7 GB/s解决方法 您正在运行VPS服务器.这意味着您的物理计算机上还有其他客户端以及它们如何使用磁盘会影响您的读写性能.
通常在RAID10上,您的写入速率约为读取速率的1/2.但是,由于存在许多未知变量,可能会有另一个客户端对磁盘进行大量写入 *** 作,这就是为什么您会看到更差的写入速度.
与他们一起打开机票并不会有什么坏处,但是使用VPS,这就是你通常会看到的. VPS是为了方便和有价值,而不是为了提高性能.
编辑:可以肯定的是,缓存是一个问题,但我的观点仍然适用.
确保使用fdatasync命令运行dd命令以确保它实际上将文件数据刷新到磁盘而不仅仅是内存,默认情况下内核会执行此 *** 作.即:
dd bs=1M count=512 if=/dev/zero of=test conv=fdatasync总结
以上是内存溢出为你收集整理的linux – 磁盘写入速度比读取速度慢得多全部内容,希望文章能够帮你解决linux – 磁盘写入速度比读取速度慢得多所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)