Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/spring-boot/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring boot 弹簧启动执行器/健康端点响应慢?_Spring Boot_Spring Boot Actuator - Fatal编程技术网

Spring boot 弹簧启动执行器/健康端点响应慢?

Spring boot 弹簧启动执行器/健康端点响应慢?,spring-boot,spring-boot-actuator,Spring Boot,Spring Boot Actuator,第一次尝试执行器依赖项时,我将其配置为opt-in management.endpoints.enabled-by-default=false management.endpoint.info.enabled=true management.endpoint.health.enabled=true 当我在本地调用/exactor/health时,大约需要1.4秒来响应。请记住,这是一个本地调用,来自服务器的同一台机器 如果我创建一个响应为空的常规端点,那么请求只需要几毫秒 这正常吗?我能让它回

第一次尝试执行器依赖项时,我将其配置为opt-in

management.endpoints.enabled-by-default=false
management.endpoint.info.enabled=true
management.endpoint.health.enabled=true
当我在本地调用
/exactor/health
时,大约需要1.4秒来响应。请记住,这是一个本地调用,来自服务器的同一台机器

如果我创建一个响应为空的常规端点,那么请求只需要几毫秒


这正常吗?我能让它回复得更快吗?

基本上,健康端点的实现方式是,它包含实现接口HealthIndicator的所有SpringBean的列表

每个健康指示器负责提供关于一个子系统的健康信息(例如:磁盘、postgres、mongo等),spring boot附带了一些预定义的健康指示器

因此,当调用健康端点时,它会遍历此列表,获取关于每个子系统的信息,然后构造答案

因此,您可以在相关的健康指标中放置一个断点(假设您知道检查了哪些子系统)并查看发生了什么

如果您正在寻找HTTP入口点—调用时被调用的代码http:///actuator/health (根据您的设置可能会有所不同,但您知道了)`,您可以在这里找到它

另一种方法是禁用“可疑”健康检查,并通过消除来发现慢检查

例如,如果您有elastricsearch并希望禁用它,请在application.properties中使用:

management.health.elasticsearch.enabled = false

你不应该复制和粘贴别人的答案,除非你引用它。这是最初的答案: