-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Why not use "blocking queries" with Consul? #374
Comments
I have read source of ocelot, with test, and I found if use service discovery and load balancer, ocelot will get health reroute server every request and it will affect performance. So I think memorycache and block queries would be useful. |
@SnailDev Thanks for your interest in the project. This sounds good, I don't know if the .net package I used to talk to Consul supports this blocking queries model you mention. The performance impact of calling consul on every request is tiny because you should be calling consul agent as a sidecar on localhost. Yes there is a cost associated with this and polling consul for the services is a good idea and has been on my todo list for a long time! If you would like to have a go at implementing this change I'm happy to accept a PR! |
* WIP - implement a consul service discovery poller, lots of shared code with existing, refactor next and a todo in the docs to finish * #374 implement polling for consul as option * #374 updated docs to remove todo * #374 fixed failing unit test * #374 fixed failing unit test * #374 fixed failing acceptance test
I have merged a new feature that will allow users to specify if they want to poll consul |
Released in 7.0.5 |
@TomPallister I have read your solution. but there are two problems:
private async Task Poll()
{
_logger.LogInformation("Started polling consul");
_services = await _consulServiceDiscoveryProvider.Get();
_logger.LogInformation("Finished polling consul");
} please confirm it, thank you very much. |
@TomPallister by the way, may be you need to take some time to know block queries, more detail: https://www.consul.io/api/index.html , and you use consuldotnet in ocelot with consul, This API also assumes some knowledge of Consul, including things like blocking queries and consistency modes |
@SnailDev cool!!! It's not high on priority list at the moment but I would be happy to accept a PR if you want a challenge! |
Expected Behavior / New Feature
Blocking Queries could notify ocelot the latest configuration immediately (when store configuration in consul) and the latest health services immediately(when service discovery and load balancer).
The text was updated successfully, but these errors were encountered: