networkservicemesh / sdk

Apache License 2.0
33 stars 36 forks source link

Add and test balancing logic for selecting the cross-nse #790

Open denis-tingaikin opened 3 years ago

denis-tingaikin commented 3 years ago

Description

Currently, we're not using a balancing algorithm in selecting cross-nse. Nsmgr permutates all forwarders in some order (based on hash).

Motivation

We could add a balancing logic for selecting the cross-nse as we do in https://github.com/networkservicemesh/sdk/tree/master/pkg/networkservice/common/roundrobin This could reduce the load on one of the forwarders.

Note: we may use balancing only for forwarders that provide the same mechanisms.

Example1:

We could have a few instances of forwarders with different image versions to be compatible with older clients.

Exapmple2:

forwarder with type A could have only N active connections. So if we need to have 2*N connections then we could just deploy an additional forwarder instance.

Definition of done

We can use roundrobin or any other balancing chain element together with discoverforwarder.

denis-tingaikin commented 3 years ago

@edwarnicke Today we discussed these cases at our local meeting. What do you think about this? :)

denis-tingaikin commented 3 years ago

In p2mp we realized that this makes sense.

denis-tingaikin commented 2 years ago

Entry points:

  1. https://github.com/networkservicemesh/sdk/blob/main/pkg/networkservice/common/discover/server.go#L79
  2. https://github.com/networkservicemesh/sdk/blob/main/pkg/networkservice/common/discoverforwarder/server.go#L100-L116
  3. https://github.com/networkservicemesh/sdk/blob/main/pkg/networkservice/common/roundrobin/server.go#L52
denis-tingaikin commented 2 years ago

Currently we don't plan add it