envoyproxy / envoy

Cloud-native high-performance edge/middle/service proxy
https://www.envoyproxy.io
Apache License 2.0
24.83k stars 4.77k forks source link

Load balancing simulation and visualization #7974

Open htuch opened 5 years ago

htuch commented 5 years ago

It is often challenging to fully grok the interaction of Envoy's sophisticated load balancing schemes, priorities, localities, failover, overprovisioning, health, panic mode, etc. We have some documentation describing this at https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/upstream/load_balancing/load_balancing, but there is still a significant gap between this and truly understanding e2e the resulting LB behavior from a given configuration.

I think some tooling here would be quite amazing. Two ideas:

  1. A CLI tool that takes a Cluster configuration, as well as endpoint health and registration status (e.g. in a ClusterLoadAssignment) and produces a distribution of expected traffic across endpoints.

  2. A web UX similar to (1) that allows the visual construction of the LB topology and other inputs. This would then be able to use some sort of visual representation of load distributions across hosts (even just proportionally sized circles would be neat as a starting point). As a bonus, the real Envoy LB implementation could be used in the browser via WebAsm and fakes/mocks.

This is not high priority but would be an amazing documentation and user education feature for someone with the right skillset for (1) and (2).

ynqa commented 3 years ago

A CLI tool that takes a Cluster configuration, as well as endpoint health and registration status (e.g. in a ClusterLoadAssignment) and produces a distribution of expected traffic across endpoints.

I implemented a command-line tool (the first plan): ynqa/envoy-lb-simulator. This is still a prototype that has not considered DNS resolution and health checking. It simply iterates chooseHost given times against clusters field in config file.

mattklein123 commented 3 years ago

Awesome!! cc @tonya11en who might be interested in checking out ^.

ynqa commented 3 years ago

To count the assignments for endpoints can understand the simple load balancing algorithm such as random, round-robin, but others are difficult to grasp their behaviors.