gpt4 book ai didi

java - 监控Springboot 2.0 Tomcat服务器线程利用率

转载 作者:行者123 更新时间:2023-11-28 22:23:58 26 4
gpt4 key购买 nike

我已经使用以下 tomcat 参数启动了我的 springboot 应用程序

-Dserver.tomcat.max-threads=400
-Dserver.tomcat.max-connections=4000

我想监控繁忙的线程和繁忙的连接大小?

springboot里面有内置解决方案吗?否则我需要获取 mbean 吗?

找到相似的 question但尚未给出解决方案。

谢谢。

最佳答案

起初,我使用 Spring Boot Actuator 和 Micrometer。但它不显示 tomcat 线程利用率。所以我像这样配置了 application.yml。

server:
port: 3200
address: 0.0.0.0
tomcat:
max-threads: 4000
mbeanregistry:
enabled: true

我将 server.tomcat.mbeanregistry.enabled 设置为 true。然后在/actuator/metrics 中显示 Tomcat 线程利用率。

这是我的输出。

{
"names": [
"http.server.requests",
"http.server.requests.histogram",
"jvm.buffer.count",
"jvm.buffer.memory.used",
"jvm.buffer.total.capacity",
"jvm.classes.loaded",
"jvm.classes.unloaded",
"jvm.gc.live.data.size",
"jvm.gc.max.data.size",
"jvm.gc.memory.allocated",
"jvm.gc.memory.promoted",
"jvm.gc.pause",
"jvm.memory.committed",
"jvm.memory.max",
"jvm.memory.used",
"jvm.threads.daemon",
"jvm.threads.live",
"jvm.threads.peak",
"jvm.threads.states",
"logback.events",
"process.cpu.usage",
"process.files.max",
"process.files.open",
"process.start.time",
"process.uptime",
"system.cpu.count",
"system.cpu.usage",
"system.load.average.1m",
"thread.pool.core.size",
"thread.pool.max.size",
"thread.pool.pool.size",
"thread.pool.thread.count",
"tomcat.cache.access",
"tomcat.cache.hit",
"tomcat.global.error",
"tomcat.global.received",
"tomcat.global.request",
"tomcat.global.request.max",
"tomcat.global.sent",
"tomcat.servlet.error",
"tomcat.servlet.request",
"tomcat.servlet.request.max",
"tomcat.sessions.active.current",
"tomcat.sessions.active.max",
"tomcat.sessions.alive.max",
"tomcat.sessions.created",
"tomcat.sessions.expired",
"tomcat.sessions.rejected",
"tomcat.threads.busy",
"tomcat.threads.config.max",
"tomcat.threads.current"
]
}

关于java - 监控Springboot 2.0 Tomcat服务器线程利用率,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57572370/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com