生产环境配置:
操作系统:CentOS 6.6
#并发连接程序从网上以下载好,然后上传到服务器
1.配置并发连接程序脚本及模板
[[email protected] tools]# rz
rz waiting to receive.
zmodem trl+C Transferring get_netstat_conn.zip...
[[email protected] tools]# unzip get_netstat_conn.zip
#把脚本复制到/cacti/scripts下
[[email protected] get_netstat_conn]# mv get_netstat_tcp.pl /var/www/html/cacti/scripts
[[email protected] scripts]# chmod 755get_netstat_tcp.pl
[[email protected] scripts]# perlget_netstat_tcp.pl 127.0.0.1 2c public 161 500
established:1 listen:0 timewait:7timeclose:0 finwait1:0 finwait2:0 synsent:0 synrecv:0 closewait:0
在cacti界面Import Templates项中导入cacti_graph_template_snmp_get_netstat_connection.xml模版文件
接下来可以在device设备中创建:
*Create Graphs forthis Host #创建主机图象
*DataSource List #数据源列表
*GraphList #图列表
Webbench测试工具的使用
生产环境配置:
操作系统:CentOS 6.6
测试工具:webbench
任务:webbench模拟N个并发连接测试网站的负载能力。
1.安装配置过程:
[[email protected] tools]#wget http://blog.s135.com/soft/linux/webbench/webbench-1.5.tar.gz#电信网络下载无问题,移动网络无法下载
[[email protected]]# tar zxfv webbench-1.5.tar.gz
[1.安装配置过程:
[[email protected] tools]#wget http://blog.s135.com/soft/linux/webbench/webbench-1.5.tar.gz#电信网络下载无问题,移动网络无法下载
[[email protected]]# tar zxfv webbench-1.5.tar.gz
[[email protected]]# cd webbench-1.5
[[email protected]]#
[[email protected]]# make && make install
出现下列错误:
错误1:
[[email protected]]# make && make install
ctags *.c
/bin/sh: ctags: command not found
make: [tags] Error 127 (ignored)
解决方式:
[[email protected]]#yum install ctags
错误2:
[[email protected]]# make && make install
cc -Wall -ggdb -W -O -c -o webbench.o webbench.c
webbench.c: 在函数‘alarm_handler’中:
webbench.c:77: 警告:未使用的参数‘signal’
cc -Wall -ggdb -W -O -o webbench webbench.o
ctags *.c
[email protected]]# cd webbench-1.5
[[email protected]]#
[[email protected]]# make && make install
出现下列错误:
错误1:
[[email protected]]# make && make install
ctags *.c
/bin/sh: ctags: command not found
make: [tags] Error 127 (ignored)
解决方式:
[[email protected]]#yum install ctags
错误2:
[[email protected]]# make && make install
cc -Wall -ggdb -W -O -c -o webbench.o webbench.c
webbench.c: 在函数‘alarm_handler’中:
webbench.c:77: 警告:未使用的参数‘signal’
cc -Wall -ggdb -W -O -o webbench webbench.o
ctags *.c
解决方式:
[[email protected] webbench-1.5]# rm -f *.owebbench *~ core *.core tags # 清除安装时留下的文件
[[email protected] webbench-1.5]# ldconfig
[[email protected] webbench-1.5]# mkdir /usr/local/man
[[email protected] webbench-1.5]# make && make install
install -s webbench /usr/local/bin
install -m 644 webbench.1 /usr/local/man/man1
install -d /usr/local/share/doc/webbench
install -m 644 debian/copyright/usr/local/share/doc/webbench
install -m 644 debian/changelog/usr/local/share/doc/webbench
2.webbech测试及运行结果: #Linux服务端测试
[[email protected] webbench-1.5]# webbench -c 100 -t 20 http://117.40.239.9/bbs/index.php
Webbench - Simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open SourceSoftware.
Benchmarking: GET http://117.40.239.9/bbs/index.php
100 clients, running 20 sec.
Speed=8115 pages/min, 28184 bytes/sec.
Requests: 2705 susceed, 0 failed.
测试结果:通过webbech压力测试,用cacti监控netstat不同网络状态并发连接数。在linux客户端测试500客户端连接服务器,用30秒时间访问该地址,服务器在瞬间的响应速度非常慢。
[[email protected] webbench-1.5]# webbench -c 500 -t 30 http://bbs.jxatei.net/bbs/forum.php
Webbench - Simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open SourceSoftware.
Benchmarking: GET http://bbs.jxatei.net/bbs/forum.php
500 clients, running 30 sec.
Speed=1016 pages/min, 1001878 bytes/sec.
Requests: 463 susceed, 45 failed.
示意图如下: