freeradius-server icon indicating copy to clipboard operation
freeradius-server copied to clipboard

Load balance across module connections in v4

Open alandekok opened this issue 6 years ago • 2 comments

We want to have modules (e.g. radius) open multiple connections, and manage connections to multiple home servers. At the same time, we want to do load-balancing, etc. in the server core, instead of pushing that to the modules.

We can't instantiate multiple versions of the same module, one for each connection / home server. The issue there is that the module instance tree isn't thread-local (tho maybe it should be). Also, if a module clones itself, what does that mean?

i.e. we have:

load-balance {
   radius
}

How will the module tell the parent keyword that there are multiple instances of itself?

One option is to just have the module register keyword-specific callbacks. That way the load-balance keyword can ask the module how many connections it has, and then do load-balancing across those connections.

That does seem somewhat solution-specific tho.

The unlang compile && interpret phase then have to be updated to know about the dynamic number of children, instead of using g->num_children.

alandekok avatar Feb 06 '19 16:02 alandekok

On some reflection, it seems better to do this in the connection pool and/or trunk code. That way each module can just say "get me connection X", and the connection comes from one of a set of equivalent connections.

Exactly how to do that is another question.

alandekok avatar Feb 11 '21 14:02 alandekok

The trunk code is intended to be used with all the connections going to the same destination. We could use one trunk per destination and manage that within the module. That's how I was thinking of doing it anyway...

arr2036 avatar Feb 11 '21 14:02 arr2036