rlm_perl multiple processes/threads behavior

Nick Rogers ncrogers at gmail.com
Thu Sep 18 16:47:57 CEST 2014

On Wed, Sep 17, 2014 at 11:25 PM, Iliya Peregoudov <iperegudov at cboss.ru>

> rlm_perl had never spawn perl processes. rlm_perl embeds perl into the
> radiusd process space, so no inter-process communication is needed to call
> perl functions.

Thanks for clarifying.

> rlm_perl in freeradius 1.1 uses pool of interpreters. radiusd thread take
> first unused interpreter from pool when rlm_perl is entered and put the
> interpreter back to the pool when rlm_perl is leaved.
> rlm_perl in freeradius 2.1 or higher uses interpreter per thread model.
> When the thread enters the rlm_perl for first time the interpreter is
> allocated and tied to the thread.
> Perl interpreter allocation is only used when perl library is compiled
> with USE_ITHREADS. If no USE_ITHREADS, then module is marked as thread
> unsafe when built. freeradius core ensures not to call rlm_perl instance in
> multiple threads simultaneously and rlm_perl instance uses single
> interpreter.

Is MULTIPLICITY still necessary?

Is the CLONE function still relevant at all?

> If you want single rlm_perl instance to be called simultaneously from
> different thread you need perl built with USE_ITHREADS.
> However you can always call multiple rlm_perl instances simultaneously.
> Define multiple perl instances with same script, and call them from
> load-balance group:
> This sounds like a good alternative for me and something I was thinking
about trying to figure out. I was expecting to have to build out multiple
virtual servers somehow and load balance between them. I did not realize
you could simply load balance between rlm_perl modules. Thanks!

> module pl1 {
>   module = ${confdir}/pl.pl
> }
> module pl2 {
>   module = ${confdir}/pl.pl
> }
> module pl3 {
>   module = ${confdir}/pl.pl
> }
> module pl4 {
>   module = ${confdir}/pl.pl
> }
> authorize {
>   load-balance {
>     pl1 # 25% of requests go here
>     pl2
>     pl3
>     pl4
>   }
> }
> On 16.09.2014 22:20, Nick Rogers wrote:
>> Hello,
>> I am hoping someone can clarify some questions I have about how rlm_perl
>> should behave in FreeRADIUS 2.2.5 with respect to multiple instances and
>> freeradius threads. I know there has been some discussion and
>> changes/fixes to this behavior over the years, and I've been using
>> rlm_perl successfully for nearly the last decade. Previously rlm_perl
>> had its own "thread" pool, where multiple instances of the perl process
>> would run simultaneously. Now I understand that rlm_perl uses the same
>> freeradius thread management that everything else does.
>> My problem is that my freeradius rlm_perl installation no longer spawns
>> multiple instances of the perl process, effectively causing my server to
>> be single threaded, which has begun to cause performance issues at some
>> of my larger sites with increased load.
>> I do not have perl with multiplicity or ithreads compiled, as this
>> causes issues with other perl applications running on the same server.
>> My question is, is there a way to support multiple instances of the
>> rlm_perl interpreter without having ithreads or multiplicity compiled
>> with perl?
>> Is there a way for freeradius to simply launch a perl process for every
>> freeradius server thread, instead of all threads relying on the same
>> rlm_perl process? I am not interested in using perl threads or having
>> multiple perl interpreters within the same perl process. I would really
>> appreciate some clarification if this is possible or not.
>> Thanks!
>> -Nick
> -
> List info/subscribe/unsubscribe? See http://www.freeradius.org/
> list/users.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeradius.org/pipermail/freeradius-users/attachments/20140918/6b6842c1/attachment.html>

More information about the Freeradius-Users mailing list