-
-
Notifications
You must be signed in to change notification settings - Fork 588
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
Load Balancing on custom metric #1234
Comments
What is the question or problem? |
I am not sure how to make a service aware of a "dynamic" value (like the cpu in the CpuStrategy) which i could use in a custom LB-Strategy. Example: i have 3 instances/nodes of 1 service. This service is exposing an action called "assign". The service also has a "assigncounter" which is incremented if a "service.assign" is called at the specific instance. Now i want to Loadbalance - so i have to know which instance has the lowest "assigncounter". So: How could a LB-Strategy access such dynamic service variables? :) |
It can be only complicated way. The CPU strategy can work because CPU usage is shared between nodes, the INFO packet contains it. But a custom value is not shared and synchronized between the nodes. For this purpose, I recommend to use Redis to store and increment the value of your variable and get this value from the Redis in your Strategy. |
Ah, ok. Thanks :) Redis is already my "plan b". Would be nice if there would be an option to register custom stats in the future. |
Is your feature request related to a problem? Please describe.
I want to use custom metrics like the cpu strategy
Additional context
I have multiple instances of one service. Every service can handle a limited amount of "slots". If no slot is available the load balancer should not try to send the request to the service which has no slots available.
The text was updated successfully, but these errors were encountered: