AirVantage / sbulb

UDP load balancer prototype using bcc (XDP/Bpf)
36 stars 9 forks source link

Make maximum ports/realservers/associations allowed configurable #23

Closed sbernard31 closed 5 years ago

sbernard31 commented 5 years ago

Add new command line options to set bpf max size :

  -mp MAX_PORTS, --max_ports MAX_PORTS
                        Set the maximum number of port to load balance.
  -mrs MAX_REALSERVERS, --max_realservers MAX_REALSERVERS
                        Set the maximum number of real servers.
  -ma MAX_ASSOCIATIONS, --max_associations MAX_ASSOCIATIONS
                        Set the maximum number of associations,
                        meaning the number of foreign peer to support at the same time.

About the maximum size allowed by bpf for maps, I didn't find so much information about that. (https://github.com/iovisor/bcc/issues/1471, https://github.com/iovisor/bcc/issues/423#issuecomment-347088216 ) I was able to launch sblub with MAX_ASSOCIATIONS set to ~50000000. More than that will raise :

/virtual/main.c:123:1: error: could not open bpf map: Argument list too long
is maps/lru_hash map type enabled in your kernel?
BPF_TABLE("lru_hash", struct associationKey, __be32, associationTable, MAX_ASSOCIATIONS);
oliwer commented 5 years ago

For a single device, is there 1 association or 2 (upstream/downstream)?

sbernard31 commented 5 years ago

For a single device, is there 1 association or 2 (upstream/downstream)?

1 device => 1 association