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

Dynamic load balancing #10

Closed
murali-reddy opened this issue May 22, 2017 · 7 comments
Closed

Dynamic load balancing #10

murali-reddy opened this issue May 22, 2017 · 7 comments
Assignees
Milestone

Comments

@murali-reddy
Copy link
Member

murali-reddy commented May 22, 2017

IPVS has this nice LB method http://kb.linuxvirtualserver.org/wiki/Dynamic_Feedback_Load_Balancing_Scheduling

Which is all the more relevent in case of distrubuted load balancing requirements of 'ClusterIP' and NodePort service types. Each node doing load balancing in round robin fashion has below limitations.

  • if connections are mixture of short lived and long lived then we will end up in imbalance
  • each node is acting on the local connection information it has. Due to distrubuted nature each node ends up doing load balancing without taking account of other nodes or global state

Here is the proposal:

  • Implement monitor daemon that collects connection per endpoint from the node using contrack
  • use in-memory distrubuted key-value store to persist the data.
  • use the global view of connections to dynamically adjust the weights on each node
@bzub
Copy link
Collaborator

bzub commented Jul 7, 2017

Initial Implementation

The monitor daemon could weight real-servers with:

  • Standard pod metrics provided by Heapster
  • Readiness probe response times (if I can find that information exposed within kubernetes)

These kubernetes specific sources should alleviate the need for kube-router to maintain its own distributed data store to share weight variables. For distributed configuration between kube-router instances a ConfigMap could be updated by a daemon/Pod responsible for calculating load-balancing weights, and kube-router could watch/consume that config.

Research and Justification

There are several ways to get at least pod system-level load metrics in Kubernetes. Application-level load metrics are also increasingly common in Kubernetes apps. Especially true since it's a requirement to expose these metrics to use Horizontal Pod Autoscaling

So here's some potential sources of load metrics that our monitor daemon could support:

  • Prometheus scrape endpoints
  • Pod and Container Readiness Probe events (response times)
  • cAdvisor builtin and custom metrics
  • Ingress Controller metrics (nginx, haproxy, traefik). In real use cases these could be independent or fed through Heapster/cAdvisor or Prometheus

Heapster is a relatively mature and popular cluster addon that collects from several of the above mentioned sources, so it could be a definitive source for system-level load metrics. There is also an effort to standardize this type of information in the apiserver with a metric endpoint. This API might be more apt for app-level load metrics. More info on that in this issue, and implementation work in this repo.

@bzub bzub added this to the v0.2.0 milestone Jul 10, 2017
@SEJeff
Copy link
Contributor

SEJeff commented Sep 18, 2017

There is an ingress doing something vaguely similar, but they are storing traffic stats in etcd.

@SEJeff
Copy link
Contributor

SEJeff commented Jun 8, 2018

Also, heapster has sort of been replaced by the metrics api. Additionally, groupcache might fit into your ideas of an in-memory k/v store with the benefits of scaling out

@aauren
Copy link
Collaborator

aauren commented Aug 13, 2021

Closing as stale

@aauren aauren closed this as completed Aug 13, 2021
@murali-reddy murali-reddy changed the title Implement IPVS "Dynamic Feedback Load Balancing Scheduling" Dynamic load balancing Oct 16, 2021
@murali-reddy
Copy link
Member Author

murali-reddy commented Oct 16, 2021

some design details on how cloudfare implemented dynamic load balancing

https://blog.cloudflare.com/unimog-cloudflares-edge-load-balancer/

current implementation in kube-router is static load balancing worth while to reconsider to truly load balncing

@murali-reddy murali-reddy reopened this Oct 16, 2021
@github-actions
Copy link

github-actions bot commented Sep 6, 2023

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the Stale label Sep 6, 2023
@github-actions
Copy link

This issue was closed because it has been stale for 5 days with no activity.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Sep 11, 2023
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

4 participants