🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #38547

Re: Balancing flow to spools (was: Re: Broadband news sever comparison)

#38547
From: Curt Welch
Date: Fri, 09 Jul 1999 00:00
88 lines
5856 bytes
davidsen@tmr.com (bill davidsen) wrote:
> In article <19990708084149.553$A8_-_@newsreader.com>,
> Curt Welch <curt@kcwc.com> wrote:
>
> | The way I balanced the flow to the spools (in my own server) is to
> | calculate the current rate news is flowing into each spool and using
> | that along with the spool's size calculate the current expected
> | retention time of each spool.  I then use that number to decide which
> | spool to put each new incomming article into (the one with the longest
> | current retention). That keeps things nincely balanced even if you have
> | different size spools with different configurations.
>
> That would be a nice feature for INN, although it would tend to beat
> hell out of a new cycbuff when added. Although that's what you want to
> some extent.

I use the configured "max" size for the calculations, not the actual
size.  So new bufs don't get treated special - they act as if they
are full from the minute you turn them on.

Plus, the algorithm is to always put the next article into the buffer with
the longest current expiration.  If you used the actual size of
a new buffer then it would look like a very small buffer, and therfor
have a very short retention time.  And that would force all the traffic
into the other buffers leaving the new buffer unused.  So that clearly
wouldn't work.

> AFAIK the INN stuff is round robin, although I haven't checked the code.
> Using age of oldest article as a weighting factor would probably produce
> some desirable results.

I thought about that as well but after some examination of the idea
I realized it had some real problems.  If you use the age of the oldest
article in a buffer which is holding 30 days of news, then you are putting
new news into the buffer based on news flows that happened 30 days ago.
That means that if you change something (say either in your incoming news
stream or in the config of your spools) it could take a full 30 days to
cycle though the buffers for the first time - and may take many many full
cycles before it stabilizes (i.e. months).  And depending on the actual
algorithm it could actually oscillate forever (I think).

For example, you have three bufs the same size.  You use two to hold binary
posts and one for text.  You have 10 days retention in the text group and 2
days retention in the binary bufs.  You decide to change one of the binary
buffers into a "text" buffer.  But since the algorithm is put new articles
into the buffer with the oldest article (i.e. always overrite the oldest
news first), all new incomming text articles continue to go into the old
text buf for about the next 8 days (because the articles in the "new" text
buf are only 2 days old).  At that point, articles start going into both
buffers, but most go into the "new" buf - because it takes a lot of text
articles to overwrite each old binary article.  This lopsided flow
continues for the next two days until all the old binary files are
overwritten with new text files.  Then it switches agin.  You have buf A
with 20 days of text files, and buf B full of text files from the past 2
days - so now most text news starts going into first buf again.  And this
flip-flop flow pattern continues for who nows how long before it
stabilizes.

So, using the date of the oldest article in the buf to decide which buf to
write an article to works nicely in the fact that it's always overwriting
the oldest news (which is what you want from a logical perspective), but it
causes "shock" waves to travel though your spools for days or weeks after
you make a change and durring that time you end up with a very unbalanced
I/O patterns to your disks (like bufs that don't get any new articles for 8
days in the above example).

So, I decided to just go with the idea of measuring the current flow of
news _into_ the buffers and balancing based on that (not by equalizing the
flow but by first normalizing the flow based on the size of each buf so
buffers that are twice the size get twice the incomming flow).  If you
change your config or change the news feeds then the flow into the buffers
changes immediately instead of having to wait for weeks or months for
things to stabilize.  This always keeps your disk I/O nicely balanced which
is normally more important on a news server.

And with this algorithm you don't need to figure out what's in your spool
or what's being overwritten - you just need to know it's size and keep
track of the avg every time you write to it.

The actual definition of "current flow" which I use is really an
exponentially decaying average of past flows which counts something like
the past 5 minutes as 50% of the avg.

-- 
Curt Welch                                            http://CurtWelch.Com/
curt@kcwc.com                          Webmaster for http://NewsReader.Com/

Technical Details
Message-ID: <19990708205106.164$l5@newsreader.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: <7lj35i$cct$1@usenet45.supernews.com> <37841CE9.2545C176@mediaone.net> <UXVg3.28545$Gh.970190@newscene.newscene.com> <19990708084149.553$A8_-_@newsreader.com> <7m2uii$1j78$1@newssvr03-int.news.prodigy.com>

Show Full Headers
Complete Article Headers
Message-ID: <19990708205106.164$l5@newsreader.com>
Subject: Re: Balancing flow to spools (was: Re: Broadband news sever comparison)
Date: Fri, 09 Jul 1999 00:00:00 +0000
From: curt@kcwc.com (Curt Welch)
References: <7lj35i$cct$1@usenet45.supernews.com> <37841CE9.2545C176@mediaone.net> <UXVg3.28545$Gh.970190@newscene.newscene.com> <19990708084149.553$A8_-_@newsreader.com> <7m2uii$1j78$1@newssvr03-int.news.prodigy.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: 498908138
X-Face: "p}G*1KH{+F7EYGKLb>ogDguabZ+%,?^epeFB!nzu`)`$=QcvL1KF6<0GH!Tbc!Sqo[|tV5 %IW48mQf3K=Ci&gZ7]]aazx@]Y-nq!r5{yH/#,?@lDdUDvOfByB2hVW0.@OM%{l/{cT'{w
X-User: Curt@NewsReader.Com
Organization: NewsReader.Com
X-Url: http://CurtWelch.Com/
Newsgroups: news.software.nntp