近期的需要做负载均衡,而负载均衡就涉及到资源的利用情况,本文主要分析以下方面的性能评估方式:
- 网络传输速率
- 硬盘读写速率
- 内存读写速率
1 网络传输速率
1. 工具安装 & 使用
网络带宽测试工具有比较多,如 iperf, nuttcp等 ,这里介绍iperf
安装iperf
sudo apt-get install iperf
server
iperf -s
client
iperf -c 10.32.225.37 -d
client 结果
------------------------------------------------------------
Server listening on TCP port 5001
TCP window size: 85.3 KByte (default)
------------------------------------------------------------
------------------------------------------------------------
Client connecting to 10.32.225.37, TCP port 5001
TCP window size: 255 KByte (default)
------------------------------------------------------------
[ 5] local 10.32.225.190 port 53022 connected with 10.32.225.37 port 5001
[ 4] local 10.32.225.190 port 5001 connected with 10.32.225.37 port 32906
[ ID] Interval Transfer Bandwidth
[ 5] 0.0-10.0 sec 616 MBytes 516 Mbits/sec
[ 4] 0.0-10.0 sec 860 MBytes 719 Mbits/sec
2.性能分析
A,B都是本地服务器
上行速度 516Mbits/sec ,下行速度 719Mbits/sec
A,C在不同地域的服务器
上行速度是2.7Mbits/sec,下行速度960Kbits/sec
- 不同地域性能差别很大
- 虽然是同在域但是上行和下行但是有差别.
2 硬盘的读写速度
dd if=/dev/zero of=file bs=1M count=1024
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 0.361674 s, 3.0 GB/s
/dev/zero 是一个专用于生成NULL的文件 bs表示一个块大小 count 块数目
硬盘的读写速度3GB/s
3. 内存读写速度
dd if=/dev/zero of=/dev/null bs=1M count=1024
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 0.0484203 s, 22.2 GB/s
内存的读写速度远快于内存.
1217

被折叠的 条评论
为什么被折叠?



