spring-cloud / spring-cloud-consul

Spring Cloud Consul
http://cloud.spring.io/spring-cloud-consul/
Apache License 2.0
808 stars 540 forks source link

Support service discovery list backup. (#751) #752

Closed chenzhiguo closed 1 year ago

chenzhiguo commented 2 years ago

Cache the service list data, if the Consul cluster is not available, use cache data to ensure that the service is highly available.

spencergibb commented 2 years ago

Can you describe the use case here? Both spring cloud loadbalancer and ribbon have caches for loadbalancing. If we decide to do this we should be consistent with s-c-lb https://github.com/spring-cloud/spring-cloud-commons/tree/main/spring-cloud-loadbalancer/src/main/java/org/springframework/cloud/loadbalancer/cache

chenzhiguo commented 2 years ago

@spencergibb I found that the cache in the load balancer will be lost after a certain period of time. This is not the same as the purpose of my PR. Of course, we can modify the the load balancer cache to achieve the same purpose. I don't quite clear what other help do I do?

chenzhiguo commented 2 years ago

Oh...Is there anything unsuitable?

spencergibb commented 1 year ago

If the loadbalancer cache looses information, that should be fixed. I've marked #751 for discussion.

spencergibb commented 1 year ago

You can change the TTL of the cache to something very large here https://docs.spring.io/spring-cloud-commons/docs/current/reference/html/#loadbalancer-cache-configuration

Otherwise, if you think there is a bug in spring cloud loadbalancer, open an issue in https://github.com/spring-cloud/spring-cloud-commons/issues