参考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的更多相关文章

  1. Linux 文件系统错误的修复方法 ddrescue替代dd的恢复软件 备用超级块

    Linux 文件系统错误的修复方法  ddrescue替代dd的恢复软件  备用超级块 最近处理的一件 linux 服务器断电导致文件系统启动后文件系统不可读写,数据不可用的案例,现总结下 Linux ...

  2. Linux系统备份还原工具1(DD)

    注意:只要时运行备份,建议都使用Ubuntu的Live CD功能启动来操作(即启动盘下的试用Ubuntu而不安装的功能),因为这样可以减少资源占用造成的备份不完整. 说明: 1.使用DD进行硬盘备份可 ...

  3. Nmap渗透测试使用方法

    Nmap渗透测试使用方法 目标选择2 端口选择2 操作系统和服务检测2 Nmap输出格式2 用NSE脚本深入挖掘2 HTTP服务信息3 检测SSL漏洞问题的主机3 设备扫描3 按VNC扫描5 按SMB ...

  4. linux修改主机名的方法

    linux修改主机名的方法 用hostname命令可以临时修改机器名,但机器重新启动之后就会恢复原来的值. #hostname   //查看机器名#hostname -i  //查看本机器名对应的ip ...

  5. linux忘记mysql密码找回方法

    linux忘记mysql教程密码找回方法 今天我们主要是讲一下关于linux忘记mysql密码处理方法,下面提供了5种linux忘记mysql密码找回方法哦.    方法一: # /etc/init. ...

  6. Linux自动登陆的设置方法

    前些天为了实现Linux自动登陆的方法,在网上查了很多资料,发现有不少方法,但网上有些方法的讲解不是特别清楚,或者已经过时.因此,特意整理了一下Linux自动登陆的设置方法.本文的测试环境为Cento ...

  7. Xcode 真机测试破解方法(转加修改)xcode 4.3 通过

    Xcode 真机测试破解方法(转加修改)xcode 4.3 通过 生成本机证书 应用程序->实用工具->钥匙串访问 菜单:钥匙串访问->证书助理->创建证书, 然后按以下图片顺 ...

  8. linux利用sendmail发送邮件的方法

    Linux利用sendmail发送邮件, 方法1 安装sendmail即可使用, mail -s "test" user@sohu.com bin/mail会默认使用本地sendm ...

  9. Linux环境下Swap配置方法

    Linux环境下Swap配置方法 场景: 今天下午安装一个CentOS6.5操作系统,忘记配置swap分区.看看如何安装系统之后,增加和删除swap分区.方法如下:1.内存占用情况[root@josh ...

随机推荐

  1. HP VC模块Server Profile配置快速参考(With SUS)

    以管理员身份登录VCM 准备进行Server Profiles的配置 在左侧导航栏中找到并点击"Server Profiles",在右侧主窗口的左下角点击"Add&quo ...

  2. Java fluent风格(转载)

    转载:java Fluent风格 一.我们先写一个通常的,即不使用fluent风格 1.实体类 package com.xbq.demo.stu; /** * @ClassName: Student ...

  3. loadrunner socket协议问题归纳(0)

    一.概述         Loadrunner拥有极为丰富的工具箱,供予我们制造出各种奇妙魔法的能力.其中就有此次要讨论的socket套接字操作.     二.socket概述         soc ...

  4. css 元素水平垂直方向居中

    html部分 <div class="parent"> <div class="child"> - -居中- - </div> ...

  5. 用python脚本计算某一个文件的行数

    python可以统计文件的行数,你相信吗?不管你信不信反正我信了.下面我们来看一下python怎样统计文件的行数,代码很简单,我也做了注释,很简单的实现... 1 2 3 4 5 6 7 8 9 10 ...

  6. sql主表分页查询关联子表取任意一条高效方案

    有个业务场景,主表中一条数据,在子表中有多条详情数据.对数据进行展示的时候,产品希望随意拿一条子表的数据关联展示出来,用了很多方案,但是都不够好. sql查询取子表任意一条,多个字段的方案 最终找到一 ...

  7. 团队作业4——第一次项目冲刺(Alpha版本)第二次

    一.会议内容 各人进行下一步工作 发现沟通流程问题并解决 二.各人工作 成员 计划任务 遇见难题 贡献比 塗家瑜(组长) 后端逻辑处理 无 1 张新磊 数据库搭建 无 1 姚燕彬 测试计划编写 无 1 ...

  8. (打补丁 )patch

    前言: diff:逐行比较文件的不同,并且显示出来. patch: 打补丁工具,将补丁打到老文件里面,也就是diff左边的那个文件,使得老文件和新文件一样 格式:diff [选项] 老文件 新文件 格 ...

  9. BOM对象属性定时器的调用

    使count中的内容,自动切换 <body> <h1 id="count"></h1> </body> //获取count var ...

  10. 微信Web开发者工具-下载、安装和使用图解

    开发和测试小程序,需要借助微信官方提供的微信Web开发者工具进行预览和调试代码,从下载安装到使用,大致的流程如下: 1.下载安装包 下载地址传送门:https://developers.weixin. ...