You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|spring.cloud.discovery.client.simple.local.instance-id | | The unique identifier or name for the service instance.
14
-
|spring.cloud.discovery.client.simple.local.metadata | | Metadata for the service instance. Can be used by discovery clients to modify their behaviour per instance, e.g. when load balancing.
15
-
|spring.cloud.discovery.client.simple.local.service-id | | The identifier or name for the service. Multiple instances might share the same service ID.
16
-
|spring.cloud.discovery.client.simple.local.uri | | The URI of the service instance. Will be parsed to extract the scheme, host, and port.
17
13
|spring.cloud.discovery.client.simple.order | |
18
14
|spring.cloud.discovery.enabled | true | Enables discovery client health indicators.
19
15
|spring.cloud.features.enabled | true | Enables the features endpoint.
@@ -34,6 +30,9 @@
34
30
|spring.cloud.loadbalancer.health-check.initial-delay | 0 | Initial delay value for the HealthCheck scheduler.
35
31
|spring.cloud.loadbalancer.health-check.interval | 25s | Interval for rerunning the HealthCheck scheduler.
36
32
|spring.cloud.loadbalancer.health-check.path | |
33
+
|spring.cloud.loadbalancer.health-check.refetch-instances | false | Indicates whether the instances should be refetched by the <code>HealthCheckServiceInstanceListSupplier</code>. This can be used if the instances can be updated and the underlying delegate does not provide an ongoing flux.
34
+
|spring.cloud.loadbalancer.health-check.refetch-instances-interval | 25s | Interval for refetching available service instances.
35
+
|spring.cloud.loadbalancer.health-check.repeat-health-check | true | Indicates whether health checks should keep repeating. It might be useful to set it to <code>false</code> if periodically refetching the instances, as every refetch will also trigger a healthcheck.
37
36
|spring.cloud.loadbalancer.retry.enabled | true |
38
37
|spring.cloud.loadbalancer.retry.max-retries-on-next-service-instance | 1 | Number of retries to be executed on the next <code>ServiceInstance</code>. A <code>ServiceInstance</code> is chosen before each retry call.
39
38
|spring.cloud.loadbalancer.retry.max-retries-on-same-service-instance | 0 | Number of retries to be executed on the same <code>ServiceInstance</code>.
Copy file name to clipboardExpand all lines: docs/src/main/asciidoc/spring-cloud-commons.adoc
+9-3Lines changed: 9 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -953,16 +953,22 @@ TIP: This mechanism is particularly helpful while using the `SimpleDiscoveryClie
953
953
clients backed by an actual Service Registry, it's not necessary to use, as we already get
954
954
healthy instances after querying the external ServiceDiscovery.
955
955
956
-
TIP:: This supplier is also recommended for setups with a small number of instances per service
956
+
TIP: This supplier is also recommended for setups with a small number of instances per service
957
957
in order to avoid retrying calls on a failing instance.
958
958
959
+
WARNING: If using any of the Service Discovery-backed suppliers, adding this health-check mechanism is usually not necessary, as we retrieve the health state of the instances directly
960
+
from the Service Registry.
961
+
962
+
TIP: The `HealthCheckServiceInstanceListSupplier` relies on having updated instances provided by a delegate flux. In the rare cases when you want to use a delegate that does not refresh the instances, even though the list of instances may change (such as the `ReactiveDiscoveryClientServiceInstanceListSupplier` provided by us), you can set `spring.cloud.loadbalancer.health-check.refetch-instances` to `true` to have the instance list refreshed by the `HealthCheckServiceInstanceListSupplier`. You can then also adjust the refretch intervals by modifying the value of `spring.cloud.loadbalancer.health-check.refetch-instances-interval` and opt to disable the additional healthcheck repetitions by setting `spring.cloud.loadbalancer.repeat-health-check` to `fasle` as every instances refetch
963
+
will also trigger a healthcheck.
964
+
959
965
`HealthCheckServiceInstanceListSupplier` uses properties prefixed with
960
966
`spring.cloud.loadbalancer.health-check`. You can set the `initialDelay` and `interval`
961
967
for the scheduler. You can set the default path for the healthcheck URL by setting
962
968
the value of the `spring.cloud.loadbalancer.health-check.path.default`. You can also set a specific value
963
969
for any given service by setting the value of the `spring.cloud.loadbalancer.health-check.path.[SERVICE_ID]`, substituting the `[SERVICE_ID]` with the correct ID of your service. If the path is not set, `/actuator/health` is used by default.
964
970
965
-
TIP:: If you rely on the default path (`/actuator/health`), make sure you add `spring-boot-starter-actuator` to your collaborator's dependencies, unless you are planning to add such an endpoint on your own.
971
+
TIP: If you rely on the default path (`/actuator/health`), make sure you add `spring-boot-starter-actuator` to your collaborator's dependencies, unless you are planning to add such an endpoint on your own.
966
972
967
973
In order to use the health-check scheduler approach, you will have to instantiate a `HealthCheckServiceInstanceListSupplier` bean in a <<custom-loadbalancer-configuration,custom configuration>>.
968
974
@@ -987,7 +993,7 @@ public class CustomLoadBalancerConfiguration {
987
993
}
988
994
----
989
995
990
-
NOTE:: `HealthCheckServiceInstanceListSupplier` has its own caching mechanism based on Reactor Flux `replay()`, therefore, if it's being used, you may want to skip wrapping that supplier with `CachingServiceInstanceListSupplier`.
996
+
WARNING: `HealthCheckServiceInstanceListSupplier` has its own caching mechanism based on Reactor Flux `replay()`. Therefore, if it's being used, you may want to skip wrapping that supplier with `CachingServiceInstanceListSupplier`.
Copy file name to clipboardExpand all lines: spring-cloud-commons/src/main/java/org/springframework/cloud/client/loadbalancer/reactive/LoadBalancerProperties.java
+44Lines changed: 44 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -56,8 +56,44 @@ public static class HealthCheck {
56
56
*/
57
57
privateDurationinterval = Duration.ofSeconds(25);
58
58
59
+
/**
60
+
* Interval for refetching available service instances.
Copy file name to clipboardExpand all lines: spring-cloud-loadbalancer/src/main/java/org/springframework/cloud/loadbalancer/core/HealthCheckServiceInstanceListSupplier.java
Copy file name to clipboardExpand all lines: spring-cloud-loadbalancer/src/test/java/org/springframework/cloud/loadbalancer/core/HealthCheckServiceInstanceListSupplierTests.java
0 commit comments