iperf可以用于测试服务器之间的网络状况,测试结果较为准确。

下载地址:http://centos.ustc.edu.cn/epel/5/x86_64/iperf-2.0.5-1.el5.x86_64.rpm

使用方式如下:

服务器端:

[root@login-35-31 ~]# iperf –s //-s表示iperf运行于服务器模式
————————————————————
Server listening on TCP port 5001
TCP window size: 85.3 KByte (default)
————————————————————
[ 4] local 192.168.171.64 port 5001 connected with 172.30.5.8 port 44516
[ ID] Interval Transfer Bandwidth
[ 4] 0.0-13.9 sec 1.25 MBytes 755 Kbits/sec
[ 5] local 192.168.171.64 port 5001 connected with 172.30.5.8 port 37255
[ 5] 0.0-123.4 sec 11.4 MBytes 774 Kbits/sec

客户端:

[tianjing@cdts ~]$ iperf -c 192.168.171.64 -i 2 -f K -t 120

// –c 表示iperf运行于client模式,后面加服务器端的IP

// –i 2 表示每2秒反馈一个值

// –f K 表示单位为kbyte,

// –t 表示测试的时长,默认为10s
————————————————————
Client connecting to 192.168.171.64, TCP port 5001
TCP window size: 16.0 KByte (default)
————————————————————
[ 3] local 192.168.8.66 port 57817 connected with 192.168.171.64 port 5001
[ ID] Interval Transfer Bandwidth
[ 3] 0.0- 2.0 sec 440 KBytes 220 KBytes/sec
[ ID] Interval Transfer Bandwidth
[ 3] 2.0- 4.0 sec 176 KBytes 88.0 KBytes/sec
[ ID] Interval Transfer Bandwidth
[ 3] 4.0- 6.0 sec 136 KBytes 68.0 KBytes/sec
[ ID] Interval Transfer Bandwidth
[ 3] 6.0- 8.0 sec 256 KBytes 128 KBytes/sec
[ ID] Interval Transfer Bandwidth
[ 3] 8.0-10.0 sec 128 KBytes 64.0 KBytes/sec
[ ID] Interval Transfer Bandwidth

 

iozone用于测试存储的读写性能,下载地址:http://tree.repoforge.org/redhat/el5/en/x86_64/rpmforge/RPMS/iozone-3.394-1.el5.rf.x86_64.rpm

使用方法:

[tianjing@cdts ~]$iozone -i 0 -i 1 -i 2 -Rab ./test-iozone.xls -g 20G -n 256M -C | tee ./iozone.log

-i 测试类型 0=write/rewrite 1=read/re-read 2=random-read/write
-R 输出execl报表
-a 在希望的文件系统上测试
-b execl文件名
-g 最大测试文件大小
-n 最小测试文件大小
-C 显示每个节点的吞吐量

iozone可以把测试的结果数据保存在execl文件中,然后可以用execl画图。

结果如下所示:

 

因为这台机器物理内存为16G,所以前面几行基本使用到了cache,测试结果并不可靠,只有最后一行文件大小为20G的测试结果比较可靠,所以为了减小内存cache对测试结果的影响,文件大小一般为内存的3倍以上。

 

sysbench也可以用于测试系统性能,下载地址:http://centos.ustc.edu.cn/epel/5/x86_64/sysbench-0.4.12-5.el5.x86_64.rpm

cpu测试

sysbench –test=cpu –num-threads=32 –cpu-max-prime=90000 run
素数的加法运算

io测试
IO 文件总大小3G,16个并发线程 随机读写模式。执行完后会在当前目录下生成一堆小文件

sysbench –test=fileio –num-threads=16 –file-total-size=3G –file-test-mode=rndrw prepare
sysbench –test=fileio –num-threads=16 –file-total-size=3G –file-test-mode=rndrw run
sysbench –test=fileio –num-threads=16 –file-total-size=3G –file-test-mode=rndrw cleanup

memory测试

sysbench –test=memory –memory-block-size=8192 –memory-total-size=4G run

threads测试

sysbench –num-threads=64 –test=threads –thread-yields=100 –thread-locks=2 run

Mutex测试(这个没有用过)

sysbench –test=mutex –num-threads=16 \ –mutex-num=1024 –mutex-locks=10000 –mutex-loops=5000 run