-
-
Notifications
You must be signed in to change notification settings - Fork 17
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
Weighted loadbalancing (client steering), WG peer config push to clients #87
Conversation
ff80afd
to
80a963f
Compare
80a963f
to
77bf443
Compare
Ugh, I might have to redesign the worker background threads for metrics etc. Although at the bottom it says that version 1.6 has improved in this regard. |
In the future we should add another json response called |
e0503fb
to
120655a
Compare
120655a
to
c64038d
Compare
@DasSkelett would it be possible to improve the test coverage? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should test it soon.
@DasSkelett can you check the conflicts? |
4e61b52
to
413bcaf
Compare
7c85e5f
to
0a65399
Compare
* Workers publish their number of connected peers per domain * Workers publish their status, i.e. up or down * The new /api/v2/exchange endpoint returns a predetermined gateway endpoint for clients * This gateway is chosen based on weighted loadbalancing between online workers/gateways * Fetch worker data through netlink and publish with MQTT: * Read worker pubkey, port and link address from interface. * Publish it together with the external domain / address (read from the config file) via MQTT to the broker.
0a65399
to
bab86f7
Compare
Even more bugs fixed from the old code, pretty happy with it now. A test deploy of the broker on one of our hosts was fine. |
The new version of ffmuc-mesh-vpn-wireguard-vxlan supports load-balancing of clients using wgkex. See freifunkMUC/wgkex#87 for details.
The new version of ffmuc-mesh-vpn-wireguard-vxlan supports load-balancing of clients using wgkex. See freifunkMUC/wgkex#87 for details.
The new version of ffmuc-mesh-vpn-wireguard-vxlan supports load-balancing of clients using wgkex. See freifunkMUC/wgkex#87 for details.
The new version of ffmuc-mesh-vpn-wireguard-vxlan supports load-balancing of clients using wgkex. For details, see - freifunkMUC/wgkex#87 - freifunk-gluon/community-packages#100 - freifunk-gluon/community-packages#101 - freifunk-gluon/community-packages#102
The new version of ffmuc-mesh-vpn-wireguard-vxlan supports load-balancing of clients using wgkex. For details, see - freifunkMUC/wgkex#87 - freifunk-gluon/community-packages#100 - freifunk-gluon/community-packages#101 - freifunk-gluon/community-packages#102 (cherry picked from commit fc42990)
The new version of ffmuc-mesh-vpn-wireguard-vxlan supports load-balancing of clients using wgkex. For details, see - freifunkMUC/wgkex#87 - freifunk-gluon/community-packages#100 - freifunk-gluon/community-packages#101 - freifunk-gluon/community-packages#102
The new version of ffmuc-mesh-vpn-wireguard-vxlan supports load-balancing of clients using wgkex. For details, see - freifunkMUC/wgkex#87 - freifunk-gluon/community-packages#100 - freifunk-gluon/community-packages#101 - freifunk-gluon/community-packages#102
The new version of ffmuc-mesh-vpn-wireguard-vxlan supports load-balancing of clients using wgkex. For details, see - freifunkMUC/wgkex#87 - freifunk-gluon/community-packages#100 - freifunk-gluon/community-packages#101 - freifunk-gluon/community-packages#102
The new version of ffmuc-mesh-vpn-wireguard-vxlan supports load-balancing of clients using wgkex. For details, see - freifunkMUC/wgkex#87 - freifunk-gluon/community-packages#100 - freifunk-gluon/community-packages#101 - freifunk-gluon/community-packages#102
The new version of ffmuc-mesh-vpn-wireguard-vxlan supports load-balancing of clients using wgkex. For details, see - freifunkMUC/wgkex#87 - freifunk-gluon/community-packages#100 - freifunk-gluon/community-packages#101 - freifunk-gluon/community-packages#102
In-progress work to add weighted loadbalancing between workers/gateways to wgkex. This allows for steering clients between gateways for better load distribution. Relatedly, parts of the WireGuard config (endpoint address+port, pubkey, gateway wg interface address) is now pushed to clients in the exchange API response.
See #39 and #49 and freifunkMUC/site-ffm#142
Overview
Each worker periodically scans for the number of connected peers for each interface/domain, and publishes the value through MQTT.
Each worker publishes its WireGuard PubKey, WireGuard listening port, WireGuard interface address and externally resolvable hostname/public IP address (read from config) through MQTT.
The broker stores the metrics and worker data. When a client hits the exchange endpoint, the best worker based on a simple weighting algorithm is selected.
The PubKey, interface address and external address+port for this worker is returned in the response to the client, like:
The weighting algorithm
Based on the total number of connected peers the should-be value for each worker is calculated like
target = (worker_weight / sum_of_weights) * total_peers
.Then the difference with the actual number of connections is calculated:
diff = (actual_peers - target)
The worker list is then sorted by the difference values; the worker with the lowest diff value is chosen (usually below 0, i.e. "clients missing").
MQTT topics
Publishing keys broker->worker:
wireguard/{domain}/{worker}
Publishing metrics worker->broker:
wireguard-metrics/{domain}/{worker}/connected_peers
Publishing worker status:
wireguard-worker/{worker}/status
Publishing worker data:
wireguard-worker/{worker}/{domain}/data
Other cleanup
wgkex.{worker,config,common,broker}.*
, which allows running most tests withpython3 -m unittest
as well. The exception is netlink_test.py, as somehow the mocking doesn't work 100% there yet.This required changes in the BUILD files, and the mocking code.
load_config()
the config system has been refactored.The config is read and parsed and converted into a
Config
object only once at first use.The
Config
class is now used as primary access to the config values, instead of using the bare dict.TODO:
Possible after merge in future iterations:
client.suppress_exceptions
on worker to avoid crashes when errors are raised.gluon-mesh-wireguard-vxlan
, so the clients actually choose the returned gateway. This can be done afterwards, though.Closes #39