Article View: news.software.nntp
Article #21793Re: A history file question.
From: Olaf Titz
Date: Tue, 23 Sep 1997 00:00
Date: Tue, 23 Sep 1997 00:00
80 lines
4795 bytes
4795 bytes
Steve Day <sad001@no-stinking-spam.com> wrote:
> After a history rebuild, the history.dir file will be somewhere around 63
> bytes. Over a period of time this number will increase to 123. Once it
> gets to 123, it stays there and there seems to be about a 10% drop in
> performance. The size of history.pag remains the same until the .dir file
> hits 123 bytes. The history.pag file then starts increasing in size.
Hint: if history.pag grows you have trouble.
In detail: "cat" the history.dir file. It consists of two(*) lines of
text like this:
dbz 3 617647 9 C 32 31 26 4 3 2 1 0
336602 340958 359137 377054 388899 384884 390261 359715 343472 363304 411748
(*) Some versions of dbz use three lines, not relevant here
The third field in the first line tells how many entries the hash
table has. The first field in the second line tells how many of them
are actually in use (i.e. the number of lines in the history).
For optimum performance, no more than about 70% of the slots should be
in use, or else the collision rate goes up and history lookups take
more time. In the above example: 336602/617647 is about 0.54, far on
the safe side.
The rest of the second line is a "history" of the used size. On each
history rebuild (i.e. expire run), the second line is shifted right
one entry and the new size added to the left. The process takes the
maximum of those numbers to determine how big the hash table should
get. This way the history file may grow and shrink a bit due to
varying volume without the hash table suddenly becoming too small.
Resizing the hash table while running is impossible. If too many
collisions occur (more precisely: if a lookup yields more than 10 used
slots before finding a free one), dbz adds a second hash table which
is used after the first one is exhausted. The hash table is the
history.pag file. So when the history.pag file grows, you have history
lookups taking more than _ten_ string comparisons and associated file
reads, as opposed to _one_ in the normal case. No wonder the whole
thing gets slow.
> If I run fixhist and the makehistory -r -s "line count" then the
> process starts all over again.
> Is this normal, or is there a problem that can be corrected? I am
> having to run fixhist about every two weeks to keep the performance up.
With makehistory, a new hash table is started from scratch. In this
case the info on how many entries were used in the past is not
preserved and the second line is filled with zeros after the first
(big) number. This is the reason why the history.dir file, while
remaining small, keeps growing a bit (for the first 10 days after a
makehistory run, actually).
The symptoms you describe all point to an expire process not working
correctly. For troubleshooting, do the following: when performance
starts degrading, look at the second line in the history.dir file. The
numbers usually should go up and down, reflecting varying history
sizes. If, however, you see a monotonic decreasing(*) sequence, this
means your history file is growing steadily and not getting cut back
by expire. It deletes articles (or else your spool disk would explode
;-) but it doesn't delete history entries. Likely reason: too little
disk space while running expire. The new history can't be written, and
the old one is re-used. (Until manual fixhist cuts it back.)
(*) as described above, the sequence is filled in from right to left
So to make a long story short: Make sure in your NEWSCTL there is
always enough space for _two_ copies of the whole history file. Or
give the "expdir=DIR" argument to news.daily, where DIR is on a disk
that has enough space for another history file. If that was not the
reason, perhaps the above contains enough hints do dig further anyway.
olaf
--
___ Olaf.Titz@inka.de or @{stud,informatik}.uni-karlsruhe.de ____
__ o <URL:http://www.inka.de/~bigred/> <IRC:praetorius>
__/<_ >> Just as long as the wheels keep on turning round
_)>(_)______________ I will live for the groove 'til the sun goes down << ____
Technical Details
Message-ID:
<606sdp$uhm$1@bigred.inka.de>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-mailReferences:
<5vvb4o$2kl$1@ccnet3.ccnet.com>Show Full Headers
Complete Article Headers
Message-ID: <606sdp$uhm$1@bigred.inka.de> Subject: Re: A history file question. Date: Tue, 23 Sep 1997 00:00:00 +0000 From: olaf@bigred.inka.de (Olaf Titz) References: <5vvb4o$2kl$1@ccnet3.ccnet.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: 274669452 X-Complaints-To: newsmaster@bigred.inka.de X-Trace: bigred.inka.de 874968316 31288 (None) 127.0.0.1 Organization: private Linux site, southern Germany Newsgroups: news.software.nntp