Thread View: news.software.nntp
6 messages
6 total messages
Started by Avi Freedman
Sun, 13 Jul 1997 00:00
Diablo Q
Author: Avi Freedman
Date: Sun, 13 Jul 1997 00:00
Date: Sun, 13 Jul 1997 00:00
14 lines
722 bytes
722 bytes
Hey, Matt - What's the reason you don't go totally cyclic? Locking overhead? I'm doing multi-process news receiving with semaphore locking with some totally custom code to cyclic files and it goes zoom just fine... Avi
Re: Diablo Q
Author: Matt Dillon
Date: Sun, 13 Jul 1997 00:00
Date: Sun, 13 Jul 1997 00:00
54 lines
2301 bytes
2301 bytes
:In article <5qaheh$d5u@netaxs.com>, Avi Freedman <freedman@netaxs.com> wrote:
:>Hey, Matt -
:>
:>What's the reason you don't go totally cyclic?
:>Locking overhead?
:>
:>I'm doing multi-process news receiving with semaphore locking
:>with some totally custom code to cyclic files and it goes zoom
:>just fine...
:>
:>Avi
It depends heavily on how the code works. If you are doing an
exclusive lock to write a record:
exclusive lock
append to cyclic file
unlcok
Then you effectively single-thread that portion of the code. As
the number of processes build, it becomes more of a bottleneck
because any delay (e.g. buffer cache miss) whatsoever inside the
semaphore will block ALL the processes rather then just one.
There are ways around the problem. In diablo, I switched from an
exclusive file lock for append to a non-blocking record lock:
/*
* Lock the append point.
*/
off = lseek(HFd, 0L, 2);
while (hflock(HFd, off, XLOCK_NB|XLOCK_EX) < 0)
off += sizeof(History);
(note: hflock a procedure in diablo/lib/lock.c that does a fcntl()
record lock).
This is a cool algorithm, IMHO, because it is virtually guarenteed to
work efficiently no matter how many processes are trying to append to
the history file. The only problem with it is that you need to hold the
lock until you are sure no other process is holding an 'old' append
offset. Diablo is a bit inefficient in the way it checks at the moment,
but I'll clean it up in the next few releases. You can't just hold the
lock forever, that would create a mess inside the kernel.
-Matt
Re: Diablo Q
Author: Jeff Garzik
Date: Sun, 13 Jul 1997 00:00
Date: Sun, 13 Jul 1997 00:00
28 lines
1799 bytes
1799 bytes
(copy cc'd to author) Avi Freedman wrote: > Hmm. I figure that it doesn't matter. With 20 or 30 (or only 5 or as > many as 200) processes receiving news, only one stream of data can get > to the disk at once anyway - and most of the wait is on the network, > not the disk side. That's presuming you open and use every file with the O_SYNC flag. Otherwise, bunches of processes will write to the buffer cache at (virtually) the same time, only to have update or a similar tool gather all the writes together and sync(2) the files onto disk at a later time. That whole delayed write thing. :) Diablo takes advantage of this fairly well. New history entries are written to the end of the file, which are efficiently grouped together so that instead of a lot of tiny writes (Diablo's history rec size is around 28 bytes I think), fewer, larger blocks are flushed onto disk at a later time. Article writes aren't as efficient (each process appends to its own file), but Unix delayed writes optimize this too. -- Jeff Garzik Quality news feeds News Administrator INN Technical info, Consulting Spinne, Inc. http://www.spinne.com/usenet/
Re: Diablo Q
Author: Chrisy Luke
Date: Mon, 14 Jul 1997 00:00
Date: Mon, 14 Jul 1997 00:00
22 lines
1509 bytes
1509 bytes
On 14 Jul 1997 00:29:11 GMT, the Killer Plum Squad forced freedman@netaxs.com (Avi Freedman) to write: >Hmm. I figure that it doesn't matter. With 20 or 30 (or only 5 or as >many as 200) processes receiving news, only one stream of data can get >to the disk at once anyway - and most of the wait is on the network, >not the disk side. That may be the case on your network :-) All my servers spend most of their time waiting for the discs and the filesystem code. I have multiple network interfaces for specific parts of the service, however. :-) External feeds have their own 100BT interface directly into a switch, with an internal usenet feeding network to distribute news between the peer boxes and the reading boxes. Chris. -- == chrisy@easynet.net, chrisy@flirble.org == Newsmaster and Senior Systems Developer for Easynet Group Plc.
Re: Diablo Q
Author: Avi Freedman
Date: Mon, 14 Jul 1997 00:00
Date: Mon, 14 Jul 1997 00:00
34 lines
1941 bytes
1941 bytes
Chrisy Luke (chrisy@easynet.net) wrote: : On 14 Jul 1997 00:29:11 GMT, the Killer Plum Squad forced : freedman@netaxs.com (Avi Freedman) to write: : : >Hmm. I figure that it doesn't matter. With 20 or 30 (or only 5 or as : >many as 200) processes receiving news, only one stream of data can get : >to the disk at once anyway - and most of the wait is on the network, : >not the disk side. : : That may be the case on your network :-) All my servers spend most of : their time waiting for the discs and the filesystem code. I have : multiple network interfaces for specific parts of the service, : however. :-) External feeds have their own 100BT interface directly : into a switch, with an internal usenet feeding network to distribute : news between the peer boxes and the reading boxes. Our news box uses 8mbits/sec at peak (www.noc.netaxs.com has a graph of Philly core traffic and news-fer.netaxs.com usually uses more bwith than all of our routers and other boxes here in Philly). But I throw out > 50% of the articles as !in(active) or as spam, so I only grab the semaphore and lock the other guys out when writing a good article. Works for us... No process has ever contended for even a second waiting for the semaphore to come 'round. : Chris. Avi
Re: Diablo Q
Author: Avi Freedman
Date: Mon, 14 Jul 1997 00:00
Date: Mon, 14 Jul 1997 00:00
51 lines
2356 bytes
2356 bytes
Matt Dillon (dillon@flea.best.net) wrote: : It depends heavily on how the code works. If you are doing an : exclusive lock to write a record: : : exclusive lock : append to cyclic file : unlcok : : Then you effectively single-thread that portion of the code. As : the number of processes build, it becomes more of a bottleneck : because any delay (e.g. buffer cache miss) whatsoever inside the : semaphore will block ALL the processes rather then just one. Hmm. I figure that it doesn't matter. With 20 or 30 (or only 5 or as many as 200) processes receiving news, only one stream of data can get to the disk at once anyway - and most of the wait is on the network, not the disk side. : There are ways around the problem. In diablo, I switched from an : exclusive file lock for append to a non-blocking record lock: : : /* : * Lock the append point. : */ : : off = lseek(HFd, 0L, 2); : : while (hflock(HFd, off, XLOCK_NB|XLOCK_EX) < 0) : off += sizeof(History); : : : (note: hflock a procedure in diablo/lib/lock.c that does a fcntl() : record lock). : : This is a cool algorithm, IMHO, because it is virtually guarenteed to : work efficiently no matter how many processes are trying to append to : the history file. The only problem with it is that you need to hold the : lock until you are sure no other process is holding an 'old' append : offset. Diablo is a bit inefficient in the way it checks at the moment, : but I'll clean it up in the next few releases. You can't just hold the : lock forever, that would create a mess inside the kernel. : : -Matt Interesting... Avi
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads