Java应用性能测试:指标监控&压测工具

本文介绍了一套用于应用开发和维护过程中的性能测试工具集,包括Prometheus、Grafana、MySQL监控工具、Redis监控工具、服务器监控工具、Java应用监控工具、业务指标监控工具以及压测工具Gatling。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

本文作者:suxingrui
本文链接:https://blog.youkuaiyun.com/suxingrui/article/details/80793138
版权声明:本文为原创文章,转载请注明出处。

应用开发或维护过程中,有时候需要对特定的场景(接口等)进行性能测试。
使用一些辅导工具能够减轻我们的工作,从而把精力投入到更重要的性能优化中。
经过调研(感谢各位大神的博客论坛等),使用以下开源工具,具体教程请自行搜索。
当前调研基于Windows环境,Linux同理


指标监控

时序列数据源:prometheus-2.3.1.windows-amd64
监控展示平台:grafana-5.1.4

监控MySQL:mysqld_exporter-0.10.0.windows-amd64
添加配置my.cnf,启动执行:mysqld_exporter.exe -config.my-cnf="my.cnf"

[client]
host=
user=
password=

监控Redis:redis_exporter-v0.19.1.windows-amd64
启动执行:redis_exporter.exe -redis.addr=redis://192.168.1.101:6379

监控服务器:node_exporter-0.16.0.linux-amd64(Linux),wmi_exporter-amd64(Windows)
启动执行:wmi_exporter.exe --collector.textfile.directory=E:\monitor\windows\wmi_exporter-amd64\textfile_inputs

监控Java应用JMX:jmx_prometheus_javaagent-0.10.jar
启动脚本中添加:-javaagent:libs/jmx_prometheus_javaagent-0.10.jar=9156:conf/jmx_prometheus_config.yaml -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=9157
配置jmx_prometheus_config.yaml

---
hostPort: localhost:9157
username: 
password: 
lowercaseOutputName: true
lowercaseOutputLabelNames: true

rules:
- pattern: ".*"

监控Java应用业务指标:添加Prometheus Java Client依赖
Spring Boot的Maven工程可使用:

<dependency>
    <groupId>io.prometheus</groupId>
    <artifactId>simpleclient_spring_boot</artifactId>
    <version>0.4.0</version>
</dependency>
<dependency>
    <groupId>io.prometheus</groupId>
    <artifactId>simpleclient_hotspot</artifactId>
    <version>0.4.0</version>
</dependency>

Grafana展示的仪表板(Dashboards):

MySQL_Overview.json
prometheus-redis_rev1.json
windows-node_rev3.json
JMX-altassian-overview_rev1.json

应用业务指标需要自定义

压测工具

压测使用:gatling-charts-highcharts-bundle-2.3.1(路径不能有中文)

压测实时监控需要:influxdb-1.5.4-1
启动执行:influxd.exe -config influxdb.conf

Grafana展示:grafana_rev1.json

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值