This is nnrpd-actived.

I found that one of the huge bottlenecks in an nnrp-oriented INN system
is creating new sessions.  I spent some time and tracked down one of the
big time-consumers...  hashing the active file.  Even with sharedactive,
each client would hash the contents into a local hash table, and with a
very large active file, this took an appreciable amount of time.

My CPU's could do it a few times a second, but during peak periods, I
see 5+ new connections per second, which essentially floods the CPU.

One fix would have been to have the nnrpd that updated the shared memory
space also update a shared hash table.  I didn't like that since I still
think the sharedactive thing is uccchy.  It used to occasionally snag
a semaphore and hang a few hundred nnrpd's in limbo.  Sharing the active
file via mmap had drawbacks as well.  

I finally decided to go a different route.  I created an "active file
server".  This server reads and rehashes the active file once every 30
seconds, and will answer UDP requests about the contents of the file.

This is able to handle thousands of transactions per second, even though
I rarely even see hundreds in production use.  I can start up a hundred
nnrp sessions a second without response time suffering noticeably.

The system is designed to fall back to standard active file accesses in
the case actived falls over, which it hasn't in several months of
production use.  Hopefully my code is correct.  I would strongly advise
anyone who runs it to periodically check to see if actived has died, and
restart it.  Just because I've had luck with it,...  ;-) 

To install:  patch your nnrpd with the enclosed "group.c.patch".
Build the contents of this directory, install and run "actived", you
can compile "query" and ask it a few questions (i.e. "query alt.sex"),
and then install your new nnrpd if all looks good.

JG970605

--

I've made several changes to Joe's code (with Joe's assistance--thanks) to
make actived a bit more portable.  I've successfully compiled this version on
Solaris 2.4, Solaris 2.5.1, SunOS 4.1.4, Linux 2.0.30, and OpenBSD 2.1, so
I suspect it'll compile on just about anything now.

-Andrew Smith <aos@insync.net> 970625
