annoying stop retransmissions.

Fajar A. Nugraha list at
Tue Nov 29 13:04:59 CET 2011

On Tue, Nov 29, 2011 at 5:33 PM, Alan DeKok <aland at> wrote:
> Fajar A. Nugraha wrote:
>> For comparison purposes, we currently implement some config and db
>> schema modifications to better handle accounting packets. For example:
>> - always return ok on accounting packets that the NAS sends.
>> Implementing it requires using detail reader/writer and some unlang
>> blocks to catch some weird corner cases (e.g. Acct-Session-Time=0)
>  OK.  What does the detail reader/writer do?  Catch cases where the SQL
> DB is down?

Yup. Basically sites-available/buffered-sql

>> - use unique constraint on acctuniqueid
>  The git "master" branch has some additional changes to help make a
> more unique accounting ID.

Great to hear that. Will try it for next implementation.

I think we used UserName-acctuniqid combination (forgot the exact
implementation, can't access the server right now, sorry) to help
prevent collision, especially in the "archive" acct table. When only
using acctuniqid, I start getting collision (on test with radperf) at
around 5 million records.

>> - remove all *_alt queries
>  Yeah.  I've never really understood the need for them.  The module
> failover can do the work just as well, I think.

It may be suitable to workaround some db limitation. If the db can't
do INSERT ... ON DUPLICATE KEY UPDATE, you might get away with INSERT
on the main query and UPDATE on _alt. However we use mysql (which
support the syntax just fine) and don't want the extra query which
adds load to the db server (the _alt part), so I just remove them

>> - split "live" accounting table (those with Acct-Status-Type <>
>> 'Stop') and "archive" accounting table
>  That's necessary.  It can speed up Simultaneous-Use checking, too.

Yes. The tricky part here is that you need some kind of method to
track whether a record there is truly "alive". Thus we modified the
query and schema further to record AcctStatusType and hijacked
AcctStopTime to record when the packet was received.

A cleaner approach would probably be adding PacketTimestamp column.

>> - change most insert/update queries to "INSERT .... ON DUPLICATE KEY
>> UPDATE ...."
>> - use "DELETE IGNORE" to delete records from "live" accounting table
>  That's MySQL specific, but useful.

as I said, I use mysql :D

>> Took some effort, but it works. @Alexandre: some of the logic might be
>> relevant for your situation as well.
>  I'd like to see that added into the server for 3.0.
>  Patches?

Will try to see which parts are upstreamable.
My current implementation is too complex be used for a generic
implementation in its complete form, using stored-procedures for most
queries in dialup.conf. Plus there's another ugly hack to correctly
transfer information from "live" to "archive" accounting table.


More information about the Freeradius-Users mailing list