new rlm_sql connection pool logic

Alan DeKok aland at deployingradius.com
Mon Oct 17 21:07:40 CEST 2011


Phil Mayers wrote:
> Can we add / will you accept a patch for opening connections in the
> background / a thread? Could be a generic per-pool option. There's some
> code in that LDAP branch I created a while back.

  I'm wary of that.

> This is particularly important for rlm_ldap; lots and lots of .ac.uk
> people have problems with FR behaviour during LDAP outages. Even setting
> net_timeout really low, you incur net_timeout on each request before
> RLM_FAIL and configurable failover can kick in.

  A better approach (IMHO) is to have configurable delays for outages.
i.e. "if all connections are down, try to reconnect only once a second".
 This gets the same result of returning "no connection" to the module,
but is much faster.

  And because that could would be in the connection API, all of the
modules would benefit (SQL, LDAP, etc.)

  The only real question is which algorithm to use.  The simplest I can
think of is to track failed connection attempts.  Once the code has a
failed connection attempt, it shouldn't try to open a new connection for
1 second.  Once a connection succeeds, it can open more connections
right away.

> (n.b. I don't personally use LDAP, but I'll port the LDAP code to use
> the connection pool if this will help...)

  It will.  I've taken a look at the LDAP code, and it's pretty bad.
I'd prefer to avoid it.

  Alan DeKok.



More information about the Freeradius-Devel mailing list