gpt4 book ai didi

spring-boot - Spring Boot Actuator/health 端点响应缓慢?

转载 作者:行者123 更新时间:2023-12-04 13:56:39 24 4
gpt4 key购买 nike

第一次尝试执行器依赖项时,我将其配置为选择加入

management.endpoints.enabled-by-default=false
management.endpoint.info.enabled=true
management.endpoint.health.enabled=true

当我打电话时 /actuator/health本地响应需要大约 1.4 秒。请记住,这是来自服务器的同一台机器的本地调用。

如果我创建一个以空响应进行回复的常规端点,则请求将只需要几毫秒。

这是正常的吗?我可以让它回复得更快吗?

最佳答案

原答案:https://stackoverflow.com/a/63666118/1861769

Basically health endpoint is implemented in a way that it contains alist of all Spring beans that implement the interface HealthIndicator.

Each health indicator is responsible for supplying a healthinformation about one subsystem (examples of such subsystem are:disk,postgres, mongo, etc.), spring boot comes with some predefinedHealthIndicators.

So that when the health endpoint is invoked, it iterates through thislist and gets the information about each subsystem and then constructsthe answer.

Hence you can place a break point in relevant health indicators(assuming you know which subsystems are checked) and see what happens.

If you're looking for the HTTP entry point - the code that gets calledwhen you call http:///actuator/health (can vary dependingon your settings but you get the idea)`, it can be found here

Yet another approach that comes to mind is disabling "suspicious"health check and finding the slow one by elimination.

For example, if you have an elastricsearch and would like to disableit, use in the application.properties:

management.health.elasticsearch.enabled = false

关于spring-boot - Spring Boot Actuator/health 端点响应缓慢?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61232463/

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