rlm_redis module "patch"

Alan DeKok aland at deployingradius.com
Thu Jan 13 10:30:41 CET 2011


Gabriel Blanchard wrote:
> Attached is two new modules. Apologies ahead of time for submitting this as a tgz.
> 
> rlm_redis allows you to connect and query a redis key-store database. Basically same idea as memcached except the keys don't expire if you allow them to.

  I like redis, but haven't had much time to play with it.  It looks
interested.

> http://redis.io/
> 
> rlm_redis requires a redis server instance and the hiredis libraries to be installed https://github.com/antirez/hiredis
> 
> Preferably redis should be running version 2.2 as it allows you to expire keys.
> 
> rlm_rediswho is a module that is similar to rlm_radwho, it obviously uses the rlm_redis module. What it does is that it basically "dumps" all the accounting data/sessions into this key store database. Once a user has so many sessions (defined by trim-count) rlm_radwho will start trimming out old data. If there is no update for said user for expiry-time, the redis server itself will expire the key.

  That looks very useful.

> I anticipate the rlm_redis module could be used for something else, since it is _considerably_ faster than any sql module (about 100,000 queries per second) . But I thought that this was perfect for a radwho module as it allows you to expire stale sessions automatically, therefore the db won't grow an insane amount.

  Exactly.  It will use a lot of memory, but for ~100K users, it
shouldn't use more than a 1G.  And memory is cheap these days.

> Obviously this is all work in progress, but it appears to run stable. It compiles clean on my Mac but may need some configure script magic to make it a little more portable.

  It looks good.  Some comments:

- please use "github" to fork the freeradius repository

- add the files to the v2.1.x branch:
  rlm_redis/Makefile.in, configure.in, rlm_redis.[ch]

  rlm_rediswho/Makefile.in, configure.in, rlm_rediswho.c

- send me a "pull" request, or just email me, and I can pull the changes
over.

- re-creating the "configure" script will be done for the next release

- I suggest reformatting the code to follow the rest of the FreeRADIUS
  programming conventions

- the rediswho_expand() function is horrible.  Instead, see the function
xlat_client() in src/main/mainconfig.c.  It's smaller, simpler, and more
 capable.

- some sample configuration / documentation would be good, but not
required. :)

- a Perl script to replace "radwho" would be spectacular.

  The redis DB looks to be very interesting.  A fast key-value store has
a lot of usefulness.

  Alan DeKok.



More information about the Freeradius-Devel mailing list