磁盘IOPS计算与测量
IOPS (Input/Output Per Second)即每秒的输入输出量(或读写次数),是衡量磁盘性能的主要指标之一。IOPS是指单位时间内系统能处理的I/O请求数量,一般以每秒处理的I/O请求数量为单位,I/O请求通常为读或写数据操作请求。随机读写频繁的应用,如OLTP(Online Transaction Processing),IOPS是关键衡量指标。另一个重要指标是数据吞吐量(Throughput),指单位时间内可以成功传输的数据数量。对于大量顺序读写的应用,如VOD(Video On Demand),则更关注吞吐量指标。
传统磁盘本质上一种机械装置,如FC, SAS, SATA磁盘,转速通常为5400/7200/10K/15K rpm不等。影响磁盘的关键因素是磁盘服务时间,即磁盘完成一个I/O请求所花费的时间,它由寻道时间、旋转延迟和数据传输时间三部分构成。
寻道时间Tseek是指将读写磁头移动至正确的磁道上所需要的时间。寻道时间越短,I/O操作越快,目前磁盘的平均寻道时间一般在3-15ms。
旋转延迟Trotation是指盘片旋转将请求数据所在扇区移至读写磁头下方所需要的时间。旋转延迟取决于磁盘转速,通常使用磁盘旋转一周所需时间的1/2表示。比如,7200 rpm的磁盘平均旋转延迟大约为60*1000/7200/2 = 4.17ms,而转速为15000 rpm的磁盘其平均旋转延迟约为2ms。
数据传输时间Ttransfer是指完成传输所请求的数据所需要的时间,它取决于数据传输率,其值等于数据大小除以数据传输率。目前IDE/ATA能达到133MB/s,SATA II可达到300MB/s的接口数据传输率,数据传输时间通常远小于前两部分时间。
因此,理论上可以计算出磁盘的最大IOPS,即IOPS = 1000 ms/ (Tseek + Troatation),忽略数据传输时间。假设磁盘平均物理寻道时间为3ms, 磁盘转速为7200,10K,15K rpm,则磁盘IOPS理论最大值分别为,
IOPS = 1000 / (3 + 60000/7200/2) = 140
IOPS = 1000 / (3 + 60000/10000/2) = 167
IOPS = 1000 / (3 + 60000/15000/2) = 200
固态硬盘SSD是一种电子装置, 避免了传统磁盘在寻道和旋转上的时间花费,存储单元寻址开销大大降低,因此IOPS可以非常高,能够达到数万甚至数十万。实际测量中,IOPS数值会受到很多因素的影响,包括I/O负载特征(读写比例,顺序和随机,工作线程数,队列深度,数据记录大小)、系统配置、操作系统、磁盘驱动等等。因此对比测量磁盘IOPS时,必须在同样的测试基准下进行,即便如何也会产生一定的随机不确定性。通常情况下,IOPS可细分为如下几个指标:
Toatal IOPS,混合读写和顺序随机I/O负载情况下的磁盘IOPS,这个与实际I/O情况最为相符,大多数应用关注此指标。
Random Read IOPS,100%随机读负载情况下的IOPS。
Random Write IOPS,100%随机写负载情况下的IOPS。
Sequential Read IOPS,100%顺序负载读情况下的IOPS。
Sequential Write IOPS,100%顺序写负载情况下的IOPS。
IOPS的测试benchmark工具主要有Iometer, IoZone, FIO等,可以综合用于测试磁盘在不同情形下的IOPS。对于应用系统,需要首先确定数据的负载特征,然后选择合理的IOPS指标进行测量和对比分析,据此选择合适的存储介质和软件系统。下面的磁盘IOPS数据来自http://en.wikipedia.org/wiki/IOPS,给大家一个基本参考。
Device | IOPS | Interface | Notes |
---|---|---|---|
7200 RPM SATA drives | ~90 IOPS | SATA II | |
10k RPM SATA drives, queue depth 1 | ~130 IOPS | SATA II | fio -readonly -name iops -rw=randread -bs=512 -runtime=20 -iodepth 1 -filename /dev/sda -ioengine libaio -direct=1 |
10k RPM Serial Attached SCSI drives | ~140 IOPS | SAS | |
15k RPM Serial Attached SCSI drives | ~180 IOPS | SAS | |
10k RPM SATA drives, queue depth 24 | ~290 IOPS | SATA II | fio -readonly -name iops -rw=randread -bs=512 -runtime=20 -iodepth 24 -filename /dev/sda -ioengine libaio -direct=1 |
Simple SLC SSD | ~400 IOPS | SATA II | |
Intel X25-M G2 (MLC; As of March 2010) | ~8,600 IOPS | SATA II | Intel's data sheet claims 6,600/8,600 IOPS (80GB/160GB version) and 35,000 IOPS for random 4KB writes and reads, respectively. |
Intel X25-E (SLC; As of March 2009) | ~5,000 IOPS | SATA II | Intel's data sheet claims 3,300 IOPS and 35,000 IOPS for writes and reads, respectively. 5,000 IOPS are measured for a mix. Intel X25-E G1 has around 3 times higher IOPS compared to the Intel X25-M G2. |
OCZ Z-Drive e84, a PCI Express SLC Solid State Drive | 16,000 IOPS | PCIe | Maximum read/write speed of 800/750 MB/s). |
G.Skill Phoenix Pro et. al. | ~20,000 IOPS | SATA III | SandForce-1200 based SSD drives with enhanced firmware, states up to 50,000 IOPS, but real-world performance shows for all drives from different manufacturers ~25,000 IOPS for random read and ~15,000 IOPS for random write. |
ioDrive, a PCI-Express card with Flash | 140,000 Read IOPS, 135,000 Write IOPS | PCIe | |
ioDrive Duo | 250,000+ IOPS | PCIe | |
DDRdrive X1, a May 2009 PCI Express based solid-state drive | 300,000+ (512B Random Read IOPS) and 200,000+ (512B Random Write IOPS) | PCIe | |
Texas Memory System
RamSan-20 |
120,000+ Random Read/Write IOPS | PCIe | Inlude RAM cache and UltraCapacitor to preserve the memory non-volatile |
Texas Memory System
RamSan-630 Appliance |
1,000,000+ Random Read/Write IOPS | FC / InfiniBand | |
Violin Memory Appliance | 1,000,000+ Random Read/Write IOPS | Proprietary interconnect | |
ioDrive Octal (single PCI Express card) | 1,000,000+ Random Read/Write IOPS | PCIe |