From: iiitac@swan.pyr (Alan Cox) Subject: Re: BBS Development for Linux Date: 16 Jun 1993 16:58:02 GMT
In article <C8o6KD.Knw@crdnns.crd.ge.com> davidsen@crd.ge.com (bill davidsen) writes:
> That's one approach, I used a B+tree and finally put the database
>server at the end of a msg queue to eliminate the overhead of locking.
>Even with all that, when I get about 40 users (386-16, 7MB memory) the
>system may slow down.
The best trick I've found is to use fixed length records, and minimal locking.
With good design most locking is not neccessary. Use the nature of the OS to
help you where possible (but allow a portable solution as well - just in case).
Also stick to fast locking systems - like flock() not lockf()/fcntl().
>
> I found that the best results came from putting small messages in the
>message file, and for large messages I put the filename in and set a
>flag.
>
No don't put filenames in. Put all the text for every message into a single
file and store offset values into it. An lseek() is far faster than an open(),
and you'll get better disk throughput as the OS tries to keep a file linear
and together. Not only that but forward motion is optimized by a normal unix
(and non unix kernel), so that you can skip the seeks when moving forwards
message by message - typical user behaviour - and get the benefit of the
kernel read ahead.
Alan