wrk 分布式多机压测支持工具。使用 Prometheus 作为测试工程中服务器监控工具
- wrk 多机部署
- wrk 多机运行控制
- wrk 多机运行配置文件支持
- 支持 ubuntu
- 支持 centos
- 支持 wrk 测试脚本
- wrk 多机运行结果统计
- 测试客户机指标收集
- 测试服务器指标收集
- web UI
- 实现更合理、更准确的统计
- python3
- pipenv
git clone https://github.com/threeq/distributed-wrk-tool.git
cd distributed-wrk-tool
pipenv install
pipenv run fab installwrk
- 压测配置文件名称必须是
wrk.yaml
, 并且放到 fabfile.py 同目录下。内容如下:
# 压测客户机节点配置
nodes: [email protected],root@localhost
# 所有压测客户机节点通用配置
all:
script: # 测试脚本
threads: 1 # 每台压力机启动线程数,最好和机器的CPU个数保持一致
connections: 1 # 每台压力机创建的连接数,必须大于或者等于启动线程数
durations: 3 # 测试脚本运行时长,单位秒
time: 1 # 单位秒
url: https://www.baidu.com/ # 请求发送的地址
# 单个压测客户机节点特定配置
127.0.0.1:
connections: 2
pipenv run fab runtest
- 本地 prometheus 监控服务器安装和运行
在 wrk.yaml
里面配置监控信息。
# 监控配置
monitor:
# 服务器机器监控
prometheus:
codemirrorConfig
global:
scrape_interval: 5s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
evaluation_interval: 5s # Evaluate rules every 15 seconds. The default is every 1 minute.
# scrape_timeout is set to the global default (10s).
# Alertmanager configuration
alerting:
alertmanagers:
- static_configs:
- targets:
# - alertmanager:9093
# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
# - "first_rules.yml"
# - "second_rules.yml"
# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
codemirrorConfig
- job_name: 'client-nodes'
# metrics_path defaults to '/metrics'
# scheme defaults to 'http'.
static_configs:
- targets: ['115.159.143.62:9100']
在
monitor.prometheus
下的配置信息和原始pprometheus
配置信息完全相同, 具体配置可以参考 Prometheus官方文档
安装
pipenv run fab installprometheus
运行
pipenv run fab runprometheus
停止
pipenv run fab stopprometheus
- 测试客户机监控代理客户端安装和运行
服务器性能指标收集使用 node-exporter
安装
pipenv run fab installexporter
运行
pipenv run fab runexporter
停止
pipenv run fab stopexporter