[Devel] rand function in config file

Henning Westerholt henning.westerholt at 1und1.de
Fri Mar 30 17:08:59 CEST 2007


On Thursday 22 March 2007 09:20, Henning Westerholt wrote:
> On Wednesday 21 March 2007 17:26, you wrote:
> > > For the SER ratelimit module we have RED (random early detection).
> > > In a nutshell it samples the number of messages and for the next
> > > timeframe drops every n-th message in order to get the total number
> > >
> > >> drop (causes retransmissions) or reject?
> >
> > It's up to the user to opt for drop or reject. Personally I had
> > quite good results rejecting messages with a 500-class error
> > including a Retry-After header.
> > The Retry-After value should differ between replies though.
> > That's where the randomize function comes into play.
>
> Thanks all for your suggestions. I'll implement a simple module with some
> randomize functions.

The module is finished now, and work rather good for the mentioned use case. 
This script snippet shows the usage:

[...]
if (get_random()) {
    get_random_val();
    $avp(i:10) = ($retcode / 16777216); # 2^24
    if ($avp(i:10) < 10) {
        $avp(i:10) = 10;
    }
    append_to_reply("Retry-After: $avp(i:10)\n");
    sl_send_reply("503", "Try later");
};
# normal message processing follows
[...]

Is there interest in such a module?

Cheers,

Henning



More information about the Devel mailing list