Article View: news.software.nntp
Article #65552Re: Which is faster: retrieve article by article number, or by Msg-ID?
From: Curt Welch
Date: Thu, 29 May 2003 03:15
Date: Thu, 29 May 2003 03:15
89 lines
6018 bytes
6018 bytes
Bas Ruiter <lordsnow@home.nl> wrote: > Problem is when the servers aren't synced - if the 2nd server is missing > a load of messages I'll get a lot of "no such article" responses back, > and tere may also be articles that ARE on the 2nd server but not on my > 1st server. So I'd miss those articles altogether. An option to explore is using XHDR Message-ID on all the other servers and only doing XOVER for the new articles you didn't find on the "main" server. Of course you will want to do XOVER on your most complete server to minimize the number of articles you find on the others. It can get very complex very fast trying to deal with all the special cases and still maximize download speeds. > My concerns with doing XOVER for a group on each server is not the > download time, but the juggling I'll have to do in memory afterwards, > sorting the stuff, etc etc. I've never tried to write a newsreader that works well for huge newsgroups, but I've thought a lot about it so I can throw out some ideas ... The amount of memory you will need is an important item to think about. Some newsreaders just assume the machine has enough memory to keep all the header data in memory. They work fine on large newsgroups if you have a GB or so of memory. in your machine. Try to run on a machine with 64MB of memory and it becomes unusable. That approach is fine (and makes the programming a lot easier), but limits the usefulness of your software to only people with large machines. > On the business of sorting - does anyone recommend a particular sort for > the Subject: headers? In the multimedia groups there will be a LOT of > articles and as you know, a lot of the Subject: lines will be largely > the same. i.e. it's going to go through a lot of sorting because of the > similarities! A very useful thing to do is to reduce the data as much as possible. It's a huge waste of memory to store 100 Subject: and From: lines for a multipart post when you only need to store one. If you are trying to make a newsreader that works well with huge multipart article groups the last thing you want to do is download and sort entire xover records in their "raw" form. You need to get creative on what type of in-memory data structurs you can use to store all the data in a far more compat and quick to sort form. > A few months ago I did some research into this (OK, just spent a few > afternoons Googling) and from what I can tell Heapsort seems to be a > good candidate. It's fast, and has very modest memory requirements so it > will scale well. If you have the data in memory and just want to sort it, use quicksort. There's nothing faster and you need no extra memory. If you are working with large sized chunks of data (like xover records), build an array of pointers to the data and sort the pointers, not the data. The reasons to use anything other than quick sort are all related to other factors like what type of data structures do you need in memory or on disk for other reasons. > Another thing I was thinking of is "pre-sorting" headers as they are > downloaded into different "pools" - an "A pool", "B pool", ... etc. > according to the first letter in their Subject: line. And that's a good example. The issue isn't how long something takes to sort, the issue is finding ways so you don't have to wait on the sort. For example, the download of header data takes a a long time so why not sort as you download. Don't just pre-sort into pools, do the whole thing. For each new record you read from the network, processes it and insert it into the table. So then what you need is a data structure to allow you to insert quickly without do more than Log N amount of work. A B-tree is one way to do that. But then you have to also think about how you deal with the current article records you have from the last download. Are you going to load all them into memory somehow before you start start to download the new headers for the group and sort them into the list all in memory? Or do you need to play games with disk IO so that you don't have to load all the data into memory before starting to download? > Then each pool alone would need to be sorted, and the results can be > glued together again. Yeah, you can do a merge sort later, but as long as you are working that hard as you download, just sort the entire thing as you read each record. With the right data structures, it will be plenty fast enough. -- Curt Welch http://CurtWelch.Com/ curt@kcwc.com Webmaster for http://NewsReader.Com/
Technical Details
Message-ID:
<20030528231540.303$sq@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!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!lnsnews.lns.cornell.edu!newsstand.cit.cornell.edu!ngpeer.news.aol.com!feed3.newsreader.com!newsreader.com!news2.newsreader.com!ellis.newsreader.com!not-for-mailReferences:
<npf9dvsun1hdqbplg77evm6hsmd9nusdrf@4ax.com> <3ed4c2ea$0$2598$a1866201@newsreader.visi.com> <jbj9dvkc97essifpac828cc8167c6se2hc@4ax.com> <20030528112007.074$Pl@newsreader.com> <mql9dvk0a9mmpvh4bjufshjrfh05c271k8@4ax.com> <20030528160241.048$tn@newsreader.com> <akjadvcd5d5nin6dj2ltu1k73eg6qk1uom@4ax.com>Show Full Headers
Complete Article Headers
Message-ID: <20030528231540.303$sq@newsreader.com>
Subject: Re: Which is faster: retrieve article by article number, or by Msg-ID?
Date: Thu, 29 May 2003 03:15:40 +0000
From: curt@kcwc.com (Curt Welch)
References: <npf9dvsun1hdqbplg77evm6hsmd9nusdrf@4ax.com> <3ed4c2ea$0$2598$a1866201@newsreader.visi.com> <jbj9dvkc97essifpac828cc8167c6se2hc@4ax.com> <20030528112007.074$Pl@newsreader.com> <mql9dvk0a9mmpvh4bjufshjrfh05c271k8@4ax.com> <20030528160241.048$tn@newsreader.com> <akjadvcd5d5nin6dj2ltu1k73eg6qk1uom@4ax.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!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!lnsnews.lns.cornell.edu!newsstand.cit.cornell.edu!ngpeer.news.aol.com!feed3.newsreader.com!newsreader.com!news2.newsreader.com!ellis.newsreader.com!not-for-mail
Organization: NewsReader.Com
Newsgroups: news.software.nntp
X-Trace: NewsReader.Com i62gdO-6dZf,JN=V.-mDOZeccwm8+,Kk8RqYgD.TXk9P+14bD
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-Url: http://CurtWelch.Com/
User-Agent: NewsReader.Com
Lines: 88