在Public Cloud中,VM、Storage和Network是IaaS的三大基础。本文将介绍在Azure的VM上测试磁盘IOPS的工具和方法。

一、添加磁盘、初始化磁盘

1.添加磁盘

把相应的信息填写好后,点击OK,加载一块Disk到相应的VM。可以注意到这块Disk的IOPS是500,吞吐量是60MB/s。

2.分区和格式化

加载好后,可以在VM中看到这块Disk:

sda是系统盘,sdb是Azure VM的临时盘,之前加的一块盘是sdc,这块盘是sdd。

查看:

[root@hwcentos ~]# fdisk -cul /dev/sdd
Disk /dev/sdd: 1098.4 GB, bytes
heads, sectors/track, cylinders, total sectors
Units = sectors of * = bytes
Sector size (logical/physical): bytes / bytes
I/O size (minimum/optimal): bytes / bytes
Disk identifier: 0x00000000

磁盘容量1TB。

[root@hwcentos ~]# fdisk -cu /dev/sdd
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xabbaf8a0.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
 
Warning: invalid flag 0x0000 of partition table will be corrected by w(rite)
 
Command (m for help): p
 
Disk /dev/sdd: 1098.4 GB, bytes
heads, sectors/track, cylinders, total sectors
Units = sectors of * = bytes
Sector size (logical/physical): bytes / bytes
I/O size (minimum/optimal): bytes / bytes
Disk identifier: 0xabbaf8a0
 
Device Boot Start End Blocks Id System
 
Command (m for help): n
Command action
e extended
p primary partition (-)
p
Partition number (-):
First sector (-, default ):
Using default value
Last sector, +sectors or +size{K,M,G} (-, default ):
Using default value
 
Command (m for help): p
 
Disk /dev/sdd: 1098.4 GB, bytes
heads, sectors/track, cylinders, total sectors
Units = sectors of * = bytes
Sector size (logical/physical): bytes / bytes
I/O size (minimum/optimal): bytes / bytes
Disk identifier: 0xabbaf8a0
 
Device Boot Start End Blocks Id System
/dev/sdd1 Linux
Command (m for help): w

3.格式化硬盘

用mkfs.ext4格式化硬盘前,先查找一下帮助文件:

man mkfs.ext4

查找lazy,

lazy_itable_init[= < to disable,  to enable>]
If enabled and the uninit_bg feature is enabled, the inode table will not be fully initialized by mke2fs. This speeds up
filesystem initialization noticeably, but it requires the kernel to finish initializing the filesystem in the background when
the filesystem is first mounted. If the option value is omitted, it defaults to to enable lazy inode table initialization.

通过这个选项可以快速对磁盘进行格式化。并且在第一次挂载的时候,系统在后台把系统初始化好。

[root@hwcentos ~]# mkfs.ext4 -E lazy_itable_init /dev/sdd1
mke2fs 1.41. (-May-)
Filesystem label=
OS type: Linux
Block size= (log=)
Fragment size= (log=)
Stride= blocks, Stripe width= blocks
inodes, blocks
blocks (5.00%) reserved for the super user
First data block=
Maximum filesystem blocks=
block groups
blocks per group, fragments per group
inodes per group
Superblock backups stored on blocks:
    , , , , , , , , ,
    , , , , , , ,
    ,
 
Writing inode tables: done
Creating journal ( blocks): done
Writing superblocks and filesystem accounting information:
done
 
This filesystem will be automatically checked every mounts or
days, whichever comes first. Use tune2fs -c or -i to override.

1T的硬盘瞬间就格式化好了。

挂载并查看:

[root@hwcentos ~]# mkdir /1T
[root@hwcentos ~]# mount /dev/sdd1 /1T
[root@hwcentos ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 30G .0G 27G % /
tmpfs 841M 841M % /dev/shm
/dev/sdb1 69G 180M 66G % /mnt/resource
/dev/sdd1 1007G 200M 956G % /1T

二、测试工具IOPS

在Github搜索iops,排名第一的是cxcv/iops。

这是一个python的程序。

https://raw.githubusercontent.com/cxcv/iops/master/iops

运行这个程序测试刚刚创建的盘:

[root@hwcentos ~]# ./iops.py /dev/sdd1
/dev/sdd1, 1.10 T, sectorsize=512B, #threads=, pattern=random:
B blocks: 562.5 IO/s, 288.0 kB/s ( 2.3 Mbit/s)
kB blocks: 579.3 IO/s, 593.2 kB/s ( 4.7 Mbit/s)
kB blocks: 288.9 IO/s, 591.6 kB/s ( 4.7 Mbit/s)
kB blocks: 229.6 IO/s, 940.4 kB/s ( 7.5 Mbit/s)
kB blocks: 261.9 IO/s, 2.1 MB/s ( 17.2 Mbit/s)
kB blocks: 175.8 IO/s, 2.9 MB/s ( 23.0 Mbit/s)
kB blocks: 221.9 IO/s, 7.3 MB/s ( 58.2 Mbit/s)
kB blocks: 259.7 IO/s, 17.0 MB/s (136.1 Mbit/s)
kB blocks: 142.9 IO/s, 18.7 MB/s (149.9 Mbit/s)
kB blocks: 106.1 IO/s, 27.8 MB/s (222.5 Mbit/s)
kB blocks: 84.1 IO/s, 44.1 MB/s (352.6 Mbit/s)
MB blocks: 49.6 IO/s, 52.0 MB/s (416.1 Mbit/s)
MB blocks: 28.5 IO/s, 59.8 MB/s (478.2 Mbit/s)
MB blocks: 14.8 IO/s, 62.3 MB/s (498.3 Mbit/s)
MB blocks: 5.7 IO/s, 48.1 MB/s (384.6 Mbit/s)

可以看到IOPS在500左右,吞吐量在60MB/s左右。

三、fio测试磁盘性能

同样在Github上查找fio,axboe/fio就是fio工具。

同样,如果CentOS里设置了epel源,也可以直接yum安装:

[root@hwcentos yum.repos.d]# yum search fio
Loaded plugins: fastestmirror, security
Repository 'epel' is missing name in configuration, using id
Loading mirror speeds from cached hostfile
epel | 4.4 kB :
epel/primary_db | 6.3 MB :
epel/pkgtags | 1.2 MB :
============================================================================ N/S Matched: fio =============================================================================
dpm-rfio-server.x86_64 : DPM RFIO server
gfal2-plugin-rfio.x86_64 : Provide the rfio support for gfal2
fio.x86_64 : Multithreaded IO generation tool
root-io-rfio.x86_64 : Remote File input/output library for ROOT
 
Name and summary matches only, use "search all" for everything.
[root@hwcentos yum.repos.d]# yum install fio -y
Loaded plugins: fastestmirror, security
Repository 'epel' is missing name in configuration, using id
Loading mirror speeds from cached hostfile
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package fio.x86_64 :2.0.-.el6 will be installed
--> Finished Dependency Resolution
 
Dependencies Resolved
 
===========================================================================================================================================================================
Package Arch Version Repository Size
===========================================================================================================================================================================
Installing:
fio x86_64 2.0.-.el6 epel k
 
Transaction Summary
===========================================================================================================================================================================
Install Package(s)
 
Total download size: k
Installed size: 1.1 M
Downloading Packages:
fio-2.0.-.el6.x86_64.rpm | kB :
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : fio-2.0.-.el6.x86_64 /
Verifying : fio-2.0.-.el6.x86_64 /
 
Installed:
fio.x86_64 :2.0.-.el6
 
Complete!
[root@hwcentos yum.repos.d]# yum info fio
Loaded plugins: fastestmirror, security
Repository 'epel' is missing name in configuration, using id
Loading mirror speeds from cached hostfile
Installed Packages
Name : fio
Arch : x86_64
Version : 2.0.
Release : .el6
Size : 1.1 M
Repo : installed
From repo : epel
Summary : Multithreaded IO generation tool
URL : http://git.kernel.dk/?p=fio.git;a=summary
License : GPLv2
Description : fio is an I/O tool that will spawn a number of threads or processes doing
: a particular type of io action as specified by the user. fio takes a
: number of global parameters, each inherited by the thread unless
: otherwise parameters given to them overriding that setting is given.
: The typical use of fio is to write a job file matching the io load
: one wants to simulate.

Yum安装的版本是2.0.13,在Github上的是2.15版本。

安装好后,配置fio的测试配置文件:

[global]
ioengine=psync
direct=
thread=
norandommap=
randrepeat=
runtime=
ramp_time=
size=1g
directory=/path/to/test
 
[read4k-rand]
stonewall
group_reporting
bs=4k
rw=randread
numjobs=
iodepth=
 
[read64k-seq]
stonewall
group_reporting
bs=64k
rw=read
numjobs=
iodepth=
 
[write4k-rand]
stonewall
group_reporting
bs=4k
rw=randwrite
numjobs=
iodepth=
 
[write64k-seq]
stonewall
group_reporting
bs=64k
rw=write
numjobs=
iodepth=

这个配置文件中有4个测试,分别是顺序读、随机读、顺序写、随机写。同时测试的ioengine采用的是同步模式。

具体配置文件中的参数可以通过man fio查看。

fio fio.conf > sync.txt
grep iops sync.txt

可以看到不同测试场景下的测试结果

[root@hwcentos ~]# grep iops sync.txt
read : io=113516KB, bw=.2KB/s, iops= , runt= 60152msec
read : io=.8MB, bw=29416KB/s, iops= , runt= 60005msec
write: io=109516KB, bw=.2KB/s, iops= , runt= 60004msec
write: io=926336KB, bw=15409KB/s, iops= , runt= 60116msec

在配置文件中把测试的ioengine换成libaio:

[global]
ioengine=libaio
fio fio.conf > async.txt
grep iops async.txt
[root@hwcentos ~]# grep iops async.txt
read : io=119896KB, bw=.7KB/s, iops= , runt= 60503msec
read : io=.5MB, bw=37954KB/s, iops= , runt= 60043msec
write: io=115040KB, bw=.8KB/s, iops= , runt= 60019msec
write: io=.8MB, bw=29377KB/s, iops= , runt= 60155msec

iops有所增加,特别是随机写入增加比较大。

Azure disk iops的测试的更多相关文章

  1. 如何对Azure磁盘性能进行测试

    Azure的云存储一直是Azure比较自豪的东西,想到AWS的LSA后面有若干个9,搞得大家都以为它的存储最优秀,其实不然,Azure存储到现在没有丢过客户1bit的数据,但是Azure不会去说我们的 ...

  2. Azure磁盘的吞吐量测试

    Azure的高级存储具有吞吐量大,延迟低的特点,非常适合时间关键型的应用程序(如SQL Server, Oracle, Redis等). 但高级存储同时具有价格高的特点,用户往往对其实际的性能数据较为 ...

  3. Azure Managed Disk

    Azure的磁盘存储是保存在存储账户中的Page Blob.由于Azure Storage Account的各种限制,在设计VM的磁盘存储时,要符合Azure磁盘存储账户的最佳实践,请参考:http: ...

  4. [记录]FIO测试磁盘iops性能

    FIO测试磁盘iops性能 1.SATA和SAS盘原生IOPS如下: 2.RAID磁盘阵列对应的写惩罚级别: 3.计算功能性IOPS公式如下: 功能性 IOPS=(((总原生 IOPS×写 %))/( ...

  5. Microsoft Azure File 服务简介

    我们非常高兴地宣布在微软Azure中国区推出 Microsoft Azure File 服务预览版.Azure File 服务使用标准 SMB 2.1 协议提供文件共享.Azure 中运行的应用程序现 ...

  6. 通过Azure File Service搭建基于iscsi的共享盘

    在Azure上目前已经有基于Samba协议的共享存储了. 但目前在Azure上,还不能把Disk作为共享盘.而在实际的应用部署中,共享盘是做集群的重要组件之一.比如仲裁盘.Shared Disk等. ...

  7. 使用 PsPing & PaPing 进行 TCP 端口连通性测试

    PsPing & PaPing 介绍 通常,我们测试数据包能否通过 IP 协议到达特定主机时,都习惯使用 ping 命令.工作时 ping 向目标主机发送一个 IMCP Echo 请求的数据包 ...

  8. Azure KeyVault设置策略和自动化添加secrets键值对

    一. 关于Azure Key Vault Azure 密钥保管库可帮助保护云应用程序和服务使用的加密密钥和机密. 借助 Key Vault,可使用密钥来加密密钥和机密(例如身份验证密钥.存储帐户密钥. ...

  9. 微软宣布在Azure上支持更多的开放技术和选择

    微软和我都热爱Linux,并且就在情人节过去几天之后,我非常高兴能用几个激动人心的消息来表达这种对Linux的热爱,您将会看到在Azure上的云部署将具有更加开放的选择性和灵活性. 这些激动人心的消息 ...

随机推荐

  1. NAS、SAN、DAS 说明

    NAS 说明 1.NAS(Network Attached Storage:网络附属存储) 2.NAS 是一种采用直接与网络介质相连的特殊设备实现数据存储的机制. 3.NAS本身能够支持多种协议(如N ...

  2. Go 功能测试与性能测试

    1.功能测试 calcTriangle.go // 需要被测试的函数 func calcTriangle(a, b int) int { return int(math.Sqrt(float64(a* ...

  3. One 的使用(1)

    方法一:使用命令提示符 第一步:打开d盘  C:Users\dcf>d; 第二步:打开工作空间  D:\>Cd workspace 第三步:打开the one  D:\workspace& ...

  4. 基于“基于dockerhub的jetty镜像的ossfs镜像”部署war包,遇到的文件夹读写权限被限制的问题解决方案

    前提: “基于dockerhub的jetty镜像的ossfs镜像” 已经搭建好了. 部署准备: 1.本地打包:war包-->idea工具 mvn 打包. 2.本地sh脚本:compile_vps ...

  5. Google Chrome 未响应。是否立即重新启动?

    不当的退出会造成 Google Chrome 无法启动.出现“Google Chrome 未响应.是否立即重新启动?”的错误.要解决这个问题:      1.同时按住Windows旗帜键 + R键,调 ...

  6. 【转】ListView优化为何ViewHolder用static类

    如果有人还不了解ViewHolder为什么可以起到优化作用,我这边再做下简单说明:Android的findViewById动作是比较耗时的,需要遍历布局的树形结构,才能找到相应的视图.所以如果想在这一 ...

  7. App测试经验分享之登录注册

    要诀 另外自己总结了一些要诀,仅供参考: 1)快:快速操作,营造冲突的场景,例如加载过程中返回键交互,快速点击登录按钮,快速切换菜单项,快速多次上下拉刷新 2)变:手机横竖屏.手机切换语言.手机调整字 ...

  8. JavaWeb中的中文编码问题

    一.为什么要编码? 1.在计算机中存储信息的最小单元是1字节,即8个bit,所以能表示的字符范围是0~255个. 2.人类要表示的符号太多,无法用1个字节来完全表示. 这就是矛盾,要解决这个矛盾,就出 ...

  9. b树的实现(c++)

    转自:http://blog.chinaunix.net/uid-20196318-id-3030529.html B树的定义 假设B树的度为t(t>=2),则B树满足如下要求:(参考算法导论) ...

  10. 英语发音规则---U字母-[复习中]

    英语发音规则---U字母 一.总结 一句话总结:(注:本文所有//的音标为英音音标,[]的音标为美音音标) 1.U在开音节中发[ju ]/ ju: /? duty /'djuːtɪ/ ['dʊti] ...