[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ntop-dev
Subject:    RE: [Ntop-dev] Host Purging
From:       "Burton M. Strauss III" <Burton () ntopsupport ! com>
Date:       2003-12-12 15:51:21
Message-ID: JIEPJGFPFMFIGBNCPKGGOEFFELAA.Burton () ntopsupport ! com
[Download RAW message or body]

> I've realized that on slow PCs used to monitor many hosts, the purging
> process can take quite some time. I have made the following two changes:
> 1. hosts with pending TCP sessions are purged later
> 2. I have moved a semaphore that locks the web interface during the
> second part of the purge.
>
> 1. should be fine. 2. may cause trouble (I can;t remember why the
> semaphore was there). Bottom line: ntop works for me, but if you
> expeirnce crashes you need to let us know because probably 2. can cause
> the crash.


It was there because you used to run with the fork() call in http.c turned
off since it was such a pig on (?)Solaris.  If you don't fork, then you MUST
protect the ntop data structures or else the walk to produce the http output
could hit a host in the middle of purge and bomb.

With Linux, the fork() is implemented via a copy-on-write method and there's
almost zero cost.  Since the fork()ed child has a static copy, it's safe
even if the mutex/semaphore isn't set unless the fork() occurs in the exact
middle of the purge.

If we want to make the fork() assumption manditory (i.e. drop the
PARM_FORK_CHILD_PROCESS parameter), you could change the protected section
to just block at the fork() with the access/release calls surounding each
individual purged host.

-----Burton


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic