FreeRADIUS data structure help
B.Candler at pobox.com
Thu Mar 3 12:53:50 CET 2011
On Thu, Mar 03, 2011 at 02:21:04PM +0500, Atif Razzaq wrote:
> I have FreeRADIUS deployment where Im using sql module for
> authentication/authorization with no accounting at all.
> Im looking for a possibility where FreeRADIUS loads all information
> from database into some data structure of its own and sends back the
> response to a request based on the information it has in the data
> structure. In this way, it doesnt go to the database on each request
> rather replies back from the information it has. However, the
> information loaded from database should be updated periodically (may be
> in a seperate thread) so that the data structure holds an updated copy
> of information. By doing this, i want to minimize the overhead of
> fetching information from db on each request especially on a very busy
> system where database might not be colocated
In general, the approach I'd suggest is: build a working system first,
measure, then optimise.
You don't say which database you're using, but if it's mysql you can very
easily make a local replica (using mysql replication). This will update
very quickly, within a second or two, but minimise load on the remote DB and
continue to work if the link goes down. And a system like this is very easy
to administer and debug.
If you really want an in-RAM database, then use rlm_fastusers. Do a periodic
query which 'selects' the entire SQL database and writes it to a temporary
file, then mv this temporary file into its final place. rlm_fastusers will
automatically re-read this file into RAM when it notices it has changed.
More information about the Freeradius-Devel