--bwlimit not working right

jw schultz jw at pegasys.ws
Mon Oct 20 18:52:57 EST 2003

On Fri, Oct 17, 2003 at 10:23:27AM -0500, John Van Essen wrote:
> On 17 Oct 2003, Rene Schumann <rene.schumann at gmx.net> wrote:
> > Hello!
>> > I cant get the bwlimit option working right.
> > If i set this option over 400 kbyte per sec i still only get 400kbyte
> > per sec, whether wich value i set.
> > I try this option with a 100MB big file.
> > I use a debian stable System with rsync version 2.5.6cvs  protocol
> > version 26.
> > Can someone tell me how i can this get working?
> [ snip ]
> We use --bwlimit extensively and have experienced the same 400 kB limit.
> So you are doing nothing wrong.  It's just the nature of the beast in
> the way that it is implemented.
> Linux systems have a granularity of 10 ms.  Wait times cannot be
> shorter than that, and are rounded up if necessary.

Only _Some_ Linux systems have a 10ms granularity inversely
known as HZ or jiffies of 100HZ.  This does not apply to all
Linux systems, merely the most common.  If memory serves
Alphas run at 1024HZ and PPC at 1000HZ.  I don't recall the
default rate for ARM or sparc.  With the 2.6 kernel the
default ia32 clock rate was raised to 1000HZ (approximate)
and may be arbitrarily set.

> If you are pulling data (vs. pushing data) then rsync uses a buffer
> size of 4096.
> The forumla used to calculate the sleep time in microsecs is:
> bytes_written * 1000 / bwlimit
> 4096 * 1000 / 400 = approx. 10,000
> So attempts to use bwlimit greater than 400 ends up with a wait
> time that is rounded up to 10,000, which is effectively 409.6 kB/s
> given the 4096 byte buffeer size.  Thus the apparent ceiling.
> There is a proposed patch to accumulate wait times to make it
> more accurate which would probably solve your problem.  See this
> thread in the archives:
> http://www.mail-archive.com/rsync@lists.samba.org/msg07270.html

You are certainly welcome to try one of the patches.  Or
create your own patch that uses nanosleep which i think more
appropriate than select.

You may also wish to move bandwidth management to outside of
rsync if you need more than 4Mb/s but less than what rsync
can deliver.

	J.W. Schultz            Pegasystems Technologies
	email address:		jw at pegasys.ws

		Remember Cernan and Schmitt

More information about the rsync mailing list