Skip to content
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

Catalog Watch uses blocking queries incorrectly #827

Open
kisunji opened this issue Aug 3, 2023 · 1 comment
Open

Catalog Watch uses blocking queries incorrectly #827

kisunji opened this issue Aug 3, 2023 · 1 comment

Comments

@kisunji
Copy link

kisunji commented Aug 3, 2023

Hello, I'm working on Consul and have seen several users face issues around how spring-cloud-consul interfaces with Consul so I've been trying to investigate.

I've noticed that spring-cloud-consul-discovery polls the Consul catalog very frequently with short-lived blocking queries (specifically the call to /v1/catalog/services?wait=2s&index=<index> at default 1s intervals).

The intention for blocking queries is that you wait on one connection which will hold until any catalog changes are detected by the agent. It is meant to be an efficient alternative to frequent polling.

It should be enough to make one call to /v1/catalog/services?index=<index> without the default deadline of wait=2s. In fact, removing the ?wait= would drastically reduce the network traffic to Consul clients with no impact to service discovery.

@kisunji
Copy link
Author

kisunji commented Aug 3, 2023

A solution could be to make the default catalogServicesWatchTimeout -1 and only add timeout to the catalog request if the value is > 0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants