You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
yum install -y git openssl-devel
cd /usr/local
#git clone https://github.com/wg/wrk.git git下载太慢了, 黄海将其clone回来后放到了华为云上。
wget https://dsideal.obs.cn-north-1.myhuaweicloud.com/HuangHai/wrk.tar.gz
tar xzvf wrk.tar.gz -C wrk/
cd wrk
make
# 模拟一下测试
[root@localhost wrk]# ./wrk -t12 -c100 -d30s --latency http://www.baidu.com
Running 30s test @ http://www.baidu.com
12 threads and 100 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 274.51ms 334.30ms 2.00s 88.11%
Req/Sec 34.03 18.94 161.00 70.81%
Latency Distribution
50% 128.70ms
75% 363.95ms
90% 704.43ms
99% 1.68s
11918 requests in 30.03s, 177.60MB read
Socket errors: connect 0, read 32, write 0, timeout 74
Requests/sec: 396.88
Transfer/sec: 5.91MB
**************************************************************************************
# 扩展lua脚本, 然后压力测试一下post接口, 找一个数据库读写较多的接口进行测试。
# 扩展脚本, 然后压力测试一下cookie验证的接口
上面两个都需要尝试, 因为下一步云平台2.0版本, 我们会要求每位研发人员, 在开发接口时, 需要通过wrk进行压力测试, 并需要提交每个接口的压力测试报告。只有这样做, 才不会在最终上线时出现并发压力吃紧问题。
**************************************************************************************
# 参考资料
https://www.iteye.com/blog/zjumty-2221040
https://www.cnblogs.com/felixzh/p/8400729.html