[linux]linuxI/O测试的方法之dd
参考http://www.thomas-krenn.com/en/wiki/Linux_I/O_Performance_Tests_using_dd
Measuring Write Performance
Modern operating systems do not normally write files immediately to RAID systems or hard disks. Temporary memory that is not currently in use will be used to cache writes and reads (regarding this, see also Operating System Caches).
So that I/O performance measurements will not be affected by these caches (temporary memory), the oflag
parameter can be used. Thereby, the following two flags are interesting (for details, see dd --help
and Dd using direct or synchronized I/O):
- direct (use direct I/O for data)
- dsync (use synchronized I/O for data)
- sync (likewise, but also for metadata)
For measuring write performance, the data to be written should be read from /dev/zero[2] and ideally written it to an empty RAID array, hard disk or partition (such as using of=/dev/sda for the first hard disk or of=/dev/sda2 for the second partition on the first hard disk). If this is not possible, a normal file in the file system (such as using of=/root/testdatei1GB) can be written. The write performance achieved thereby will be a little slower (because metadata will also be written to the file system).
Important: When writing to a device (such as /dev/sda), the data stored there will be lost. For that reason, you should only use empty RAID arrays, hard disks or partitions.
Note:
- When using if=/dev/zero and bs=1G, Linux will need 1GB of free space in RAM. If your test system does not have sufficient RAM available, use a smaller parameter for bs (such as 512MB).
- In order to get results closer to real-life, we recommend performing the tests described several times (three to ten times, for example). By doing so, you can quickly detect outliers. Such outliers can include cron jobs, interrupts or general conditions due to parallel processing, which can all briefly affect performance. An extreme example, which clarifies this issue, would be the parallel execution of updatedb by a cron job.
Laptop Example
In this example, the test data will be written to /dev/sda2. The test system (a Thinkpad T43 Type 2668-4GG) had 1.5 GByte of RAM and a Fujitsu MHT2060AH hard disk rotating at 5,400 rpm.
Laptop Throughput (Streaming I/O)
One gigabyte was written for the test, first with the cache activated (hdparm -W1 /dev/sda):
root@grml ~ # dd if=/dev/zero of=/dev/sda2 bs=1G count=1 oflag=direct
1+0 records in
1+0 records out
1073741824 bytes (1.1 GB) copied, 32.474 s, 33.1 MB/s
root@grml ~ #
Then, with the cache deactivated (hdparm -W0 /dev/sda):
root@grml ~ # dd if=/dev/zero of=/dev/sda2 bs=1G count=1 oflag=direct
1+0 records in
1+0 records out
1073741824 bytes (1.1 GB) copied, 123.37 s, 8.7 MB/s
root@grml ~ #
Laptop Latency
In this test, 512 bytes were written one thousand times, first with the cache activated (hdparm -W1 /dev/sda):
root@grml ~ # dd if=/dev/zero of=/dev/sda2 bs=512 count=1000 oflag=direct
1000+0 records in
1000+0 records out
512000 bytes (512 kB) copied, 0.36084 s, 1.4 MB/s
root@grml ~ #
Then, with the cache deactivated (hdparm -W0 /dev/sda): One thousand accesses required 11.18 seconds, meaning one access took 11.18 ms.
root@grml ~ # dd if=/dev/zero of=/dev/sda2 bs=512 count=1000 oflag=direct
1000+0 records in
1000+0 records out
512000 bytes (512 kB) copied, 11.1865 s, 45.8 kB/s
root@grml ~ #
Server with RAID10 Example
In this example, the test data was written to an empty partition. The test system was an 2HE Intel Dual-CPU SC823 Server with six 147 GB SAS Fujitsu MBA3147RC (15,000 rpm) hard disks and an Adaptec 5805 RAID controller with the cache activated and a BBU.
Server Throughput (Streaming I/O)
One gigabyte was written for the test:
test-sles10sp2:~ # dd if=/dev/zero of=/dev/sda6 bs=1G count=1 oflag=dsync
1+0 records in
1+0 records out
1073741824 bytes (1.1 GB) copied, 5.11273 seconds, 210 MB/s
test-sles10sp2:~
Server Latency
In this test, 512 bytes were written one thousand times. Thereby, the 0.084 seconds that were measured for one thousand accesses corresponded to precisely 0.084 ms for each access. This value is so low because of the RAID controller’s cache:
test-sles10sp2:~ # dd if=/dev/zero of=/dev/sda6 bs=512 count=1000 oflag=dsync
1000+0 records in
1000+0 records out
512000 bytes (512 kB) copied, 0.083902 seconds, 6.1 MB/s
test-sles10sp2:~ #
[linux]linuxI/O测试的方法之dd的更多相关文章
- Linux 文件系统错误的修复方法 ddrescue替代dd的恢复软件 备用超级块
Linux 文件系统错误的修复方法 ddrescue替代dd的恢复软件 备用超级块 最近处理的一件 linux 服务器断电导致文件系统启动后文件系统不可读写,数据不可用的案例,现总结下 Linux ...
- Linux系统备份还原工具1(DD)
注意:只要时运行备份,建议都使用Ubuntu的Live CD功能启动来操作(即启动盘下的试用Ubuntu而不安装的功能),因为这样可以减少资源占用造成的备份不完整. 说明: 1.使用DD进行硬盘备份可 ...
- Nmap渗透测试使用方法
Nmap渗透测试使用方法 目标选择2 端口选择2 操作系统和服务检测2 Nmap输出格式2 用NSE脚本深入挖掘2 HTTP服务信息3 检测SSL漏洞问题的主机3 设备扫描3 按VNC扫描5 按SMB ...
- linux修改主机名的方法
linux修改主机名的方法 用hostname命令可以临时修改机器名,但机器重新启动之后就会恢复原来的值. #hostname //查看机器名#hostname -i //查看本机器名对应的ip ...
- linux忘记mysql密码找回方法
linux忘记mysql教程密码找回方法 今天我们主要是讲一下关于linux忘记mysql密码处理方法,下面提供了5种linux忘记mysql密码找回方法哦. 方法一: # /etc/init. ...
- Linux自动登陆的设置方法
前些天为了实现Linux自动登陆的方法,在网上查了很多资料,发现有不少方法,但网上有些方法的讲解不是特别清楚,或者已经过时.因此,特意整理了一下Linux自动登陆的设置方法.本文的测试环境为Cento ...
- Xcode 真机测试破解方法(转加修改)xcode 4.3 通过
Xcode 真机测试破解方法(转加修改)xcode 4.3 通过 生成本机证书 应用程序->实用工具->钥匙串访问 菜单:钥匙串访问->证书助理->创建证书, 然后按以下图片顺 ...
- linux利用sendmail发送邮件的方法
Linux利用sendmail发送邮件, 方法1 安装sendmail即可使用, mail -s "test" user@sohu.com bin/mail会默认使用本地sendm ...
- Linux环境下Swap配置方法
Linux环境下Swap配置方法 场景: 今天下午安装一个CentOS6.5操作系统,忘记配置swap分区.看看如何安装系统之后,增加和删除swap分区.方法如下:1.内存占用情况[root@josh ...
随机推荐
- k8s zookeeper、kafka部署
安装zookeeper apiVersion: v1 kind: ConfigMap metadata: name: zookeeper-config namespace: kube-system a ...
- Yii2 yii\helpers\ArrayHelper
yii\helpers\ArrayHelper 是一个数组辅助类,提供额外的数组功能函数 toArray($object, $properties = [], $recursive = true) C ...
- c# 加载图片 正在被占用问题
问题情境:图片文件加载到pdf中,程序没有退出,再次加载该图片文件,提示被占用. 解决办法: 1.加载文件会锁定该文件,fromfile方法会导致占用内存较大,不使用该方法. FileStream f ...
- CS小分队第二阶段冲刺站立会议(5月30日)
昨日成果:解决了前天遗留的问题,实现了主界面对于电脑上应用的添加和删除 遇到问题:添加和删除按钮时候,按钮位置图像与北京图片冲突,会出现闪动现象. 删除是通过右键单击出现菜单,其中有删除的选项,但是这 ...
- 基础系列(4)—— C#装箱和拆箱
一 装箱和拆箱的概念 装箱是将值类型转换为引用类型 : 拆箱是将引用类型转换为值类型 : 值类型:包括原类型(Sbyte.Byte.Short.Ushort.Int.Uint.Long.Ulong.C ...
- C语言问卷调查表
你对自己的未来有什么规划?做了哪些准备? 对未来比较迷茫,现在的主要任务是学好专业课 你认为什么是学习?学习有什么用?现在学习动力如何?为什么? 活到老学到老,学习是一辈子的事.在学习的过程 ...
- lintcode-223-回文链表
223-回文链表 设计一种方式检查一个链表是否为回文链表. 样例 1->2->1 就是一个回文链表. 挑战 O(n)的时间和O(1)的额外空间. 标签 链表 思路 找到链表中点后,翻转链表 ...
- QThread安全的结束线程
版权声明:若无来源注明,Techie亮博客文章均为原创. 转载请以链接形式标明本文标题和地址: 本文标题:QThread安全的结束线程 本文地址:http://techieliang.com/ ...
- 【leetcode】198.HouseRobber
198.HouseRobber You are a professional robber planning to rob houses along a street. Each house has ...
- SpringMVC Ajax两种传参方式
1.采用@RequestParam或Request对象获取参数的方法 注:contentType必须指定为:application/x-www-form-urlencoded @ResponseBod ...