weaveworks / weave

Simple, resilient multi-host containers networking and more.
https://www.weave.works
Apache License 2.0
6.62k stars 670 forks source link

Intelligently manage peer connections #2020

Open sheerun opened 8 years ago

sheerun commented 8 years ago

Hey. I'm not sure if that's the case, so excuse me if it's already implemented.

I see there's issue with dropped connections when max number of peers is reached: #426

Could weave implement the "soft max peers" configuration that works this way?

  1. Freely accept connections until "soft max" limit is reached
  2. If "soft max" limit is reached, accept connections only if either:
    1. They improve connectivity of weave network (e.g. node is gateway to some NAT)
    2. They are lower latency than all of already connected peers
  3. If new peer has been accepted, remove one of peers if both:
    1. They don't improve connectivity of weave network (i.e. redundant)
    2. They are high latency connection (so probably other path is faster)

The result should be optimal mesh of connections while maintaining more or less the soft limit.

awh commented 8 years ago

Thanks for the suggestion @sheerun, it's not something we do at the moment.

sheerun commented 8 years ago

I think it would allow using weave to form public mesh network :) For now the size of such network is limited by max number of connections.

bboreham commented 6 years ago

Reference #426