-
Notifications
You must be signed in to change notification settings - Fork 542
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide a way to listen to specific services instead of the whole catalog #566
Comments
The consul api we use does not provide filtering. https://www.consul.io/api/catalog.html#list-services |
Yes it doesn't provide filtering on the entire catalog. However, long polling watches can be created for each service that the application is interested in. The mechanism can be very similar to how it's done now with a background thread for each service. https://www.consul.io/api/catalog.html#list-nodes-for-service |
Having to explicitly list every service you want to watch doesn't seem scalable to me. |
I think that applications which have many upstream services can continue using the existing catalog watch mechanism. However it would be nice if microservices which only have a couple of interfaces be able to watch those they are interested in instead of the entire catalog. Here is some data on our own consul index and how quickly it changes
|
I think that is a rarity. As you mentioned, you can disable it and roll your own. We'll wait to see if there are more folks who want this. |
@alex-dubrouski please open a separate issue as that does not seem related to What doesn't seem to be scalable is to have to manually add a service that needs to be watched for the OPs use case. |
Spencer, |
Yes, but the image shows the trace coming thru the Might be worth setting |
Only small percentage of calls is coming from health services, most of them is a result of discovery. |
if that's the case, you can use tags to limit what is returned. |
Yes, this is what we actually asked to implement. Currently |
Do you both work together? For |
I had added waitTime and index in getServers() of ConsulServerList.java in my company. |
I am sorry for delay, yes we work together on one team. We will try to incorporate this research into our plans. BTW Fu already has an open PR for this repo. |
Thanks @spencergibb I'll try to explore implementing something custom when I have some time. For the PR @alex-dubrouski mentioned I have that running on our Spring Boot Admin server and with |
I need to implement the scenario in service1 where I want to know health of service2 and if it is up/running then will take action accordingly. I want to know the health of a service on a separate thread or basically in a non-blocking way. How do I implement it using catalog watch ? Is there any other way to implement as well ? Are there any examples available ? |
spring-cloud-consul
provides a Consul Catalog Watch that publishes heartbeat events on catalog changes. In an environment with many services the catalog can change rapidly (multiple times per second) causing heartbeat events to trigger for services which the application is not interested in.For example, this mechanism is used in Spring Cloud Config Client if discovery is enabled link
In practice the config client is only interested in updates to the
spring-cloud-config-server
but this triggers each time the catalog updates.The catalog services watch can already be disabled. It would be very useful if an alternative heartbeat event producer can be implemented which takes a list of relevant services and only publishes heartbeat events when those specific services are updated.
Currently any micro service in our organization will start generating many requests to consul just by adding
spring-cloud-starter-consul-discovery
. While thewatch-delay
is configurable it's less than ideal if your application is only interested in a subset of services. If thewatch-delay
is too high you risk not getting an immediate update when the services changes and if it's too low you get flooded with events.The text was updated successfully, but these errors were encountered: