Weird issue - threads bottleneck in post-proxy section

"RESTOUX, Loïc" loic.restoux at
Mon Mar 2 17:02:04 CET 2015

Le 02/03/2015 14:59, Alan DeKok wrote:
> Except the rest module doesn't have a pre-proxy or post-proxy method.
> So... what exactly are you doing?

We changed it in order to allow calling it in pre- or post-proxy 
section. Anyway, we reproduced the issue with another module, see above.

> Is the behaviour the same if you change rest for another module?

Yes. We wrote a simple module, which sleeps a little every time it is 
invoked (see attached file). We replaced rlm_rest with it and launched 
the benchmark tests again, with the exact same results:
- pre-proxy: 1250 r/s, all threads are active.
- post-proxy: 42 r/s, only part of the available threads are active.

I'm wondering if there is a critical section in proxy replies handling 
which may explain such results ?

Btw, we are using 3.0.x branch of FreeRADIUS.


This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.
-------------- next part --------------
 *   This program is is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License, version 2 if the
 *   License as published by the Free Software Foundation.
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   GNU General Public License for more details.
 *   You should have received a copy of the GNU General Public License
 *   along with this program; if not, write to the Free Software
 *   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA

 * $Id: cfd227eb73e6afd0e88f1962f2951772623028a4 $
 * @file rlm_rest.c
 * @brief Integrate FreeRADIUS with RESTfull APIs
 * @copyright 2012-2014  Arran Cudbard-Bell <arran.cudbardb at>
RCSID("$Id: cfd227eb73e6afd0e88f1962f2951772623028a4 $")

#include <freeradius-devel/radiusd.h>
#include <freeradius-devel/modules.h>
#include <freeradius-devel/token.h>
#include <freeradius-devel/rad_assert.h>

#include <ctype.h>

 *	Structure for module configuration
typedef struct rlm_lrs_t {
	char const		*xlat_name;	//!< Instance name.
    int delay;
} rlm_lrs_t;

static const CONF_PARSER module_config[] = {
	{ NULL, -1, 0, NULL, NULL }

 *	Check user info from Erable with the given password.
static rlm_rcode_t CC_HINT(nonnull) execute(void *instance, UNUSED REQUEST *request)

    return RLM_MODULE_OK;

 *	Do any per-module initialization that is separate to each
 *	configured instance of the module.  e.g. set up connections
 *	to external databases, read configuration files, set up
 *	dictionary entries, etc.
 *	If configuration information is given in the config section
 *	that must be referenced in later calls, store a handle to it
 *	in *instance otherwise put a null pointer there.
static int mod_instantiate(CONF_SECTION *conf, void *instance)
	return 0;

 *	Only free memory we allocated.  The strings allocated via
 *	cf_section_parse() do not need to be freed.
static int mod_detach(void *instance)
	return 0;

 *	The module name should be the only globally exported symbol.
 *	That is, everything else should be 'static'.
 *	If the module needs to temporarily modify it's instantiation
 *	data, the type should be changed to RLM_TYPE_THREAD_UNSAFE.
 *	The server will then take care of ensuring that the module
 *	is single-threaded.
module_t rlm_lrs = {
	RLM_TYPE_THREAD_SAFE,  /* type */
	mod_instantiate,	   /* instantiation */
	mod_detach,			   /* detach */
		NULL,	           /* authentication */
		NULL,       	   /* authorization */
		NULL,			   /* preaccounting */
		NULL,		       /* accounting */
		NULL,			   /* checksimul */
		execute,	   /* pre-proxy */
		execute,	   /* post-proxy */
		NULL,       	   /* post-auth */

More information about the Freeradius-Users mailing list