Stanislav,

On 20 Jul 2014, at 08:05, Stanislav Datskevich <[email protected]> wrote:

> I'm not a C programmer, so, could you please explain why fork() is the 
> problem? I see this feature work this way:
> 1. Place "run external command" statement into "if" statement inside the 
> filter or function, so it will be ran only on the specific updates/withdraws.
> 2. When update/withdraw message is arrived, BIRD runs external command, 
> passes message details to it as environment variables and forks it. After 
> fork BIRD is not blocked by child execution, so it will not be a performance 
> impact.

If you are carrying a large routing table of many hundreds of thousands of 
routes, losing an interface (or regaining it) will result in hundreds of 
thousands (if not millions) of withdrawals or advertisements, which will in 
turn result in hundreds of thousands of calls to fork() in order to run the 
external script. That will be very slow. Of course one answer is 'don't do that 
then'. But another possibility is to allow whatever hook is put in not only to 
run a script, but also (e.g.) to call a little bit of lua. Provided you already 
have your luaState (meaning the lua VM is already initialised), the overhead in 
calling one function in lua is tiny.

This would allow this idea to scale to hundreds of thousands or millions of 
routes without difficulty. The lua could be used to (e.g.) log certain route 
changes to a file. For instance, anyone interested in logging any advertisement 
of a route which has been both withdrawn and advertised more than twice in the 
last 10 minutes (a.k.a. a flap)? Or in logging receipt from other than the 
customer of a more specific route than one of one's customers routes that are 
not in a pre-agreed list? Or do some matching on the above and only in respect 
of /some/ of the routes, run a script? These would be simple little programs in 
lua (tens of lines maximum), but doubtless are not things that the members of 
the Ondrej Aggregate will want to take code for on a case by case basis into 
bird.

-- 
Alex Bligh




Reply via email to