How make freeradius - rlm_exec run multithreaded?

Alan DeKok aland at deployingradius.com
Sat Jan 11 00:33:21 CET 2020


On Jan 10, 2020, at 2:46 PM, Ryan Allen <ryanallenemail at gmail.com> wrote:
> 
> In FreeRadius, we are trying to use rlm_exec to call an external
> script in a multithreaded fashion, but once "exec" is called, it
> blocks other requests and only processes one request at a time.

  The server is multi-threaded.  Each thread runs independently of each other thread.  However, one thread *can* block.  And if it blocks, that thread won't process anything else.

>  We
> need to support multiple users signing in at the same time.  How can
> we make this multithreaded/multiprocessed?
> 
> Here is a simple example we used to verify the blocking issue:

  OK...

> If we send 5 requests to our freeradius server, we expect all 5
> responses to come back at about the same time, but they each respond 5
> seconds apart, and it takes about 25 seconds for all to complete.

  Is this in daemon mode, or in debug mode?  Because in debug mode, the server is single threaded.

  You can start multi-threaded debug mode via the following arguments:

radiusd -xx -f -l stdout

  You can then send multiple packets, and verify that it is running multi-threaded.

   If you do that and post that debug output, it *will* show that the server is multi-threaded.

> We know that "wait=yes" makes freeradius wait for the script to finish
> and processes what the external script sent to stdout, but we thought
> it could still handle multiple requests in parallel.

  If you have 5 threads configured, the server will be able to run 5 of those requests at the same time.

  We generally don't recommend using "exec".  It's simple, but forking programs for every packet is *slow*.  Very slow.  If you can use the built-in functionality of the server, it's much better.

  Alan DeKok.




More information about the Freeradius-Users mailing list