本文共 3354 字,大约阅读时间需要 11 分钟。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | 我的博客已迁移到xdoujiang.com请去那边和我交流 一、 网络测试工具iperf 1、安装包 apt-get -y install iperf 2、参数说明 -s, --server run in server mode(以server模式启动) -c, --client <host> run in client mode, connecting to <host>(以client模式启动) -p, --port n set server port to listen on /connect to to n (default 5001)指定服务器端使用的端口或客户端所连接的端口 -m, --print_mss print TCP maximum segment size (MTU - TCP /IP header)显示tcp最大mtu值 -f, -- format [kmKM] format to report: Kbits, Mbits, KBytes, MBytes(分别表示以Kbits, Mbits, KBytes, MBytes显示报告) -i, --interval n pause n seconds between periodic bandwidth reports(间隔时间) -t, -- time n time in seconds to transmit for (default 10 secs)(默认10秒 连接时间) -n, --num n[KM] number of bytes to transmit (instead of -t)(传输大小是字节) -w TCP_WINDOW_SIZE Controls the size of TCP buffers(tcp) 3、购买的云主机服务器(监听在9999端口 本机外网ip 1.1.1.1) iperf -s -p 9999 -m -w 102400000 4、公司内网客户端(连接服务端1.1.1.1)总连接时间200秒 服务端端口是9999 传输数据大小是10M左右) iperf -c 1.1.1.1 -t 200 -f m -p 9999 -n 10240000 -w 102400000 ------------------------------------------------------------ Client connecting to 1.1.1.1, TCP port 9999 TCP window size: 0.24 MByte (WARNING: requested 97.7 MByte) ------------------------------------------------------------ [ 3] local 10.1.10.250 port 41193 connected with 1.1.1.1 port 9999 [ ID] Interval Transfer Bandwidth [ 3] 0.0-20.2 sec 9.77 MBytes 4.06 Mbits /sec 总结:因公司环境因素 测试我云主机的服务器带宽才500KB(网卡 in 数据) 二、磁盘测试工具hdparm 1、安装包 apt-get -y install hdparm 2、hdparm -Tt /dev/vdb /dev/vdb : Timing cached reads: 19550 MB in 2.00 seconds = 9786.98 MB /sec Timing buffered disk reads: 32 MB in 3.03 seconds = 10.55 MB /sec 3、hdparm -Tt --direct /dev/vdb /dev/vdb : Timing O_DIRECT cached reads: 82 MB in 2.02 seconds = 40.59 MB /sec Timing O_DIRECT disk reads: 124 MB in 3.00 seconds = 41.28 MB /sec 4、参数说明 -T Perform timings of cache reads for benchmark and comparison purposes(测试硬盘读缓存的速度) -t Perform timings of device reads for benchmark and comparison purposes(测试硬盘读速度(不经过磁盘cache)) --direct Use the kernels "O_DIRECT" flag when performing a -t timing test (直接硬盘读测试) 三、磁盘测试工具 dd 1、速度最慢的 dd bs=64k count=4k if = /dev/zero of= test oflag=dsync 4096+0 records in 4096+0 records out 268435456 bytes (268 MB) copied, 307.7 s, 872 kB /s 2、比较常用的测试 dd bs=64k count=4k if = /dev/zero of= test conv=fdatasync 4096+0 records in 4096+0 records out 268435456 bytes (268 MB) copied, 89.2378 s, 3.0 MB /s 3、比较常用的测试 dd bs=64k count=4k if = /dev/zero of= test conv=fsync 4096+0 records in 4096+0 records out 268435456 bytes (268 MB) copied, 63.9118 s, 4.2 MB /s 4、带缓存的测试 dd bs=64k count=4k if = /dev/zero of= test 4096+0 records in 4096+0 records out 268435456 bytes (268 MB) copied, 0.321234 s, 836 MB /s 5、参数说明 dsync use synchronized I /O for data fdatasync physically write output file data before finishing fsync likewise, but also write metadata conv=CONVS convert the file as per the comma separated symbol list oflag=FLAGS write as per the comma separated symbol list bs=BYTES read and write up to BYTES bytes at a time (同时设置读/写缓冲区的字节数) count=BLOCKS copy only BLOCKS input blocks(只拷贝输入的blocks块) |