🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #41264

Re: NoCeM & INN2.3

#41264
From: Andrew
Date: Wed, 03 Nov 1999 00:00
71 lines
4484 bytes
In article <7vpog2$2qm$1@nnrp1.deja.com>, bostic@bostic.com wrote:
>Fcntl range locking is too slow for any real thread usage --
>doing a system call for an uncontested lock isn't reasonable.

That depends on the frequency of calls, of course....

The main problem with fcntl and threads is that fcntl locks don't
work between threads in the same process; any lock acquired via
fcntl belongs to the whole process, not to the calling thread.

I've used SysV semaphores for some fairly demanding applications (in
a former life, doing non-Usenet stuff). The system call overhead was
not a major issue in those cases; in fact, the ability to recover
from a process failure without deadlocks was well worth the cost in
that particular application. (Which, incidentally, was a record
locking and transaction management system built on top of an existing
ISAM-style database, so I do have some experience in this field.)

>If you look underneath Berkeley DB, there's a lot of work
>invested in doing locking mutexes that don't require system
>calls.  It's a portability nightmare, of course, but if you're
>going to run any significant numbers of threads or processes
>in an application, you have to do it.

BerkeleyDB's mutexes _suck_ if you put more than a minimal amount
of load on them, due to the fact that they use time-delayed retry
rather than any mechanism of signalling the waiting process when
a lock becomes free. This is even documented in mutex/README.

We use BerkeleyDB, as you know, in some moderately stressful internal
applications (e.g. within our authentication system) and in several
places I've found that the only way to get acceptable performance out
of it is to put pthread mutexes around whole groups of db operations
to keep the load on the db's internal locks down.

If it weren't for the fact that they use the same locking primitives
for mutexes and for long-term waits (by having a thread block on one of
its own locks and have that lock freed by another thread), I'd have
tried rewriting the db locks to use pthread calls instead.

>I've never looked inside of INN, so it's fair to say that I don't
>understand the problem.  However, it seems to me that INN is a
>database problem, and wouldn't it make sense to try a database
>solution?  I don't know what the scaling and recoverability
>requirements of INN are, but Berkeley DB already offers real
>scalability and thread support, not to mention recoverability
>after failure.

The basic problem is: new articles arrive at the rate of 10 or so per
second, and in the transit environment you have a number (tens or
hundreds) of incoming feeds all offering you articles at about this rate
which you may or may not already have. In consequence you have a _lot_
of lookups happening for entries that don't exist, and the database as
a whole is large enough that you won't want to have it all incore.

Now if I understand the way that BerkeleyDB's hash method works, then
the lookups for nonexistent entries will overwhelm the cache, as pages
get read in to locate the data that isn't there.

>And yes, Berkeley DB can do better than 500 queries a second on
>commodity hardware. :-)  I regularly see multiple thousands of
>queries a second on fairly low-end x86 hardware.

On databases of 10, 20 or 100 million records, which are being
simultaneously added to at the rate of 10 or so records per second?

-- 
Andrew, Supernews
http://www.supernews.com - UK and US individual and corporate NNTP services

Technical Details
Message-ID: <slrn821emt.edk.andrew+news@uk21.supernews.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail
References: <3819A774.9C57FDCA@boerde.de> <ylyachnwki.fsf@windlord.stanford.edu> <87u2n5wa1n.fsf@slip-32-100-243-27.ma.us.prserv.net> <yl66zlnugn.fsf@windlord.stanford.edu> <7vnkfo$cpt@bigred.inka.de> <ylg0yomrmj.fsf@windlord.stanford.edu> <7vpog2$2qm$1@nnrp1.deja.com>

Show Full Headers
Complete Article Headers
Message-ID: <slrn821emt.edk.andrew+news@uk21.supernews.com>
Subject: Re: NoCeM & INN2.3
Date: Wed, 03 Nov 1999 00:00:00 +0000
From: andrew+news@supernews.com (Andrew)
References: <3819A774.9C57FDCA@boerde.de> <ylyachnwki.fsf@windlord.stanford.edu> <87u2n5wa1n.fsf@slip-32-100-243-27.ma.us.prserv.net> <yl66zlnugn.fsf@windlord.stanford.edu> <7vnkfo$cpt@bigred.inka.de> <ylg0yomrmj.fsf@windlord.stanford.edu> <7vpog2$2qm$1@nnrp1.deja.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail
X-Deja-AN: 544145901
X-Complaints-To: newsabuse@remarq.com
X-Trace: 941669087 .MYBPHMNN00017F00C uk21.supernews.com
Organization: RemarQ http://www.remarQ.com
User-Agent: slrn/0.9.5.4 (UNIX)
Reply-To: andrew@supernews.com
Newsgroups: news.software.nntp