[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Pan-users] Policy discussion: GNKSA

From: Alan Meyer
Subject: Re: [Pan-users] Policy discussion: GNKSA
Date: Mon, 4 Jul 2011 08:42:41 -0700 (PDT)

Steven D'Aprano <address@hidden> wrote:
> More connections are only valuable when the provider applies a
> per-connection throttle which is less than your total
> bandwidth. If your total bandwidth is (say) 100Mbps, which will
> be a hard limit applied by your ISP, or possibly a physical
> limit imposed by the laws of physics and your modem, then
> adding additional connections won't increase that.
> If your news provider throttles connections to 10Mbps, then 4
> connections give you a total of 40Mbps used and 60 unused, and
> 10 connections would give you 100Mbps used and zero unused. But
> 20 connections *still* gives you 100Mbps used, because that's
> the hard limit from your ISP and/or modem -- adding more
> connections once you have saturated the available bandwidth
> just slows them all down.


There may be some news providers who throttle connections, in
which case adding more than four _might_ speed things up - but
only if the throttle speed is low relative to the connection
speed.  On the other hand there might also be news providers who
throttle downloads per user, in which case adding connections
only slows all of them down.

Duncan pointed out that, in Pan, decoding is done synchronously
with downloading.  When a download finishes, or a buffer fills,
Pan stops downloading on that thread/connection and goes to work
on decoding.  So there would be some benefit to overlapping
connections.  The amount of benefit (assuming throttling is not
an issue) would be proportional to time spent decoding divided by
time spent downloading.  Consider two cases:

Case 1: Download = 60 seconds, decode/write = 6 seconds.

In this case, the maximum benefit available is a 10% speed
increase.  That's all the time spent decoding.

If we add a second thread, and assuming that there are two CPUs
to handle the decoding, then 90% of the time, it will be
downloading during the 6 seconds of decoding in the first thread,
bringing the total efficiency to 99%.  More threads are

Case 2: Download = 60 seconds, decode/write = 60 seconds.

This case benefits from more threads.  Adding a second thread
only gets us to 75% efficiency, but four (if I've got my queueing
theory right - I might not) gets us to:

    1 - (.5 * .5 * .5 * .5) = 1 - .0625 = 93.75% efficiency

However, that will only be true if we have one CPU per decoding
thread.  If we have, say, two CPUs and four threads, the decoders
will compete for CPU time and decoding will take much more than
60 seconds per thread.

I would also guess that, even with direct memory access by the
network card, there is still some CPU overhead involved in the
download, for example in handling IP packets, computing TCP
checksums, and managing buffers.  So if the CPU is bogged down in
decoding, download speed will also be affected.

So I'm having trouble finding any situation other than per
connection throttling where having more than four connections
provides a significant advantage.

Of course in theory, theory and practice are the same.  But in
practice ... maybe I'm totally screwed up here.

Alan Meyer

reply via email to

[Prev in Thread] Current Thread [Next in Thread]