[Haskell-cafe] ANN: network-2.2.3, merger with network-bytestring

Neil Davies semanticphilosopher at gmail.com
Mon Nov 1 04:55:15 EDT 2010


What you are observing is the effects of the delay on the operation of  
the TCP stacks and the way your 'sleep' works.

You are introducing delay (the sleep time is a 'minimum' and then at  
least one o/s jiffy) - that represents one limit. The other limit is  
delay/bandwidth product of the connection hiding of this effect is  
dependent on the window size negotiated.

How accurate do you need this control of throughput? To get really  
accurate rates we had to write our own specialist rate regulated  
thread library which accounts for any scheduling delay and can even  
spin if you want low delay variance in the packet dispatch times.


On 31 Oct 2010, at 17:56, Christopher Done wrote:

> On 31 October 2010 16:14, Johan Tibell <johan.tibell at gmail.com> wrote:
>> This version marks the end of the network-bytestring package, which
>> has now been merged into the network package. This means that
>> efficient and correct networking using ByteStrings is available as
>> part of the standard network package.
>> As part of the merger, two new modules have been added:
>> Network.Socket.ByteString and Network.Socket.ByteString.lAzy
> Huzzah! I updated my little throttler program to use ByteString.[1]
> One thing I'm curious about, that maybe you probably know off the top
> of your head, is that when I'm limiting the speed, I was merely
> recv'ing and send'ing at 1024 bytes a pop[2], however, when I did this
> at, say, ~500KB/s, Firefox is really slow at receiving it, whereas
> when I set it 4096 it's much faster/more accurate to the speed I
> intend. Chrome doesn't seem to care.
> I think the difference is that Firefox is single threaded
> (select/poll-based?) and has to switch between various jobs while
> receiving every tiny block that I'm sending. Chrome probably has the
> receiver in a separate process.
> So it seems like, short of balancing the package size (at powers of 2)
> and the delay to get some ideal throughput, it's easiest and probably
> realistically equivalent to set it to 4096 and just rely on an
> accurate delay? What do you think? Just curious. This is something I
> think I'll look into in the future, I really don't have a good feel
> for typical network latency and throughput. It's not a big deal right
> now as "56k slow" is all I need to test my web app.
> [1]: http://github.com/chrisdone/throttle/commit/97e03bfc64adc074c9d1f19c2605cb496576c593
> [2]: http://github.com/chrisdone/throttle/commit/30dc1d970a7c0d43c1b6dc33da9deecf30808114
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

More information about the Haskell-Cafe mailing list