🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #38552

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

#38552
From: bill davidsen
Date: Fri, 09 Jul 1999 00:00
125 lines
7514 bytes
In article <19990708205106.164$l5@newsreader.com>,
Curt Welch <curt@kcwc.com> wrote:
| davidsen@tmr.com (bill davidsen) wrote:
| > In article <19990708084149.553$A8_-_@newsreader.com>,
| > Curt Welch <curt@kcwc.com> wrote:

| > 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.

I'm not sure what you mean by max size. If you use a partition the size
doesn't change, and if you use a file, unless you have a magic
filesystem you would always precreate a full size file to ensure it's
contiguous. At least on my systems the max size and the actual size are
one and the same number.

| 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.

Obviously if there is no data in a cycbuff you treat it as infinitely
old, that's an obvious boundary condition check. If your logic is
checking dates and there are none, I can't imagine what other date you
would use.

| > 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).

You have to use a weighting to determine which cycbuff to use. One
factor would be age of oldest article, the other would be percent full
(assuming 100% after the first wrap). Preferentially using a new cycbuff
both spreads the reader load quickly and speeds the extension of
effective retention period. Making an effort to keep the oldest article
in all cycbuffs the same age lengthens the retention also, since the
retention is the age of the youngest of the oldest articles (the date
before which all articles are not available).

By weighting the preferences any oscilation is damped and the system
tends to remain near optimal. Given that optimal changes with each new
article I think you can waste a lot of time chasing the goal. I want the
disk rates to be within 10-15% on cycbuffs, and oldest date within
minutes rather than days, but perfection is not the goal.
| 
| 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.

Honestly, I can't imagine doing that. Adding more storage is a regular
problem, but changing an existing cycbuff seems like an infrequent
operation. Now watch 20 admins post that they do it weekly:-(

| 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).

Honestly I've never moved a cycbuff from one metacycbuff to another, and
I wouldn't bet a penny that the old data would be valid until I reread
the code.
| 
| 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.

The reader i/o so vastly overwhelms the incoming i/o on most of my
machines that I am not worried about balancing incoming i/o. And on a
transit machine I probably have all the posts in a single metacycbuff,
and the change would be to add storage, in which case I would want to
put more new articles in the new cycbuff (no, not all the new articles)
to get it up to speed quickly.

The reader i/o rate is related to both the actual bytes in a cycbuff and
the number of articles. In either case I probably want to get the new
cycbuff in use fairly quickly.

| 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.

I think your method is a clever solution, but I don't believe it
optimizes the same things I think are most important. That doesn't make
either of us wrong, we have different goals, and at least you have taken
the time to generate a solution. If I get the time to do either a
simulation or an implementation I might just try to equalize the number
of articles in a cycbuff, since that is probably a useful predictor for
either feed or read use.

-- 
bill davidsen <davidsen@tmr.com>  CTO, TMR Associates, Inc
  The Internet is not the fountain of youth, but some days it feels like
the fountain of immaturity.


Technical Details
Message-ID: <7m5ekb$2mfg$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
References: <7lj35i$cct$1@usenet45.supernews.com> <19990708084149.553$A8_-_@newsreader.com> <7m2uii$1j78$1@newssvr03-int.news.prodigy.com> <19990708205106.164$l5@newsreader.com>

Show Full Headers
Complete Article Headers
Message-ID: <7m5ekb$2mfg$1@newssvr03-int.news.prodigy.com>
Subject: Re: Balancing flow to spools (was: Re: Broadband news sever comparison)
Date: Fri, 09 Jul 1999 00:00:00 +0000
From: davidsen@tmr.com (bill davidsen)
References: <7lj35i$cct$1@usenet45.supernews.com> <19990708084149.553$A8_-_@newsreader.com> <7m2uii$1j78$1@newssvr03-int.news.prodigy.com> <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
X-Deja-AN: 499195421
X-Complaints-To: abuse@prodigy.net
X-Trace: newssvr03-int.news.prodigy.com 931544523 88560 199.4.137.118 (9 Jul 1999 18:22:03 GMT)
Organization: TMR Associates, Schenectady NY
NNTP-Posting-Date: 9 Jul 1999 18:22:03 GMT
Newsgroups: news.software.nntp
Originator: davidsen@darkstar.prodigy.com