Leaky bucket algorithm
Leaky bucket algorithm
- Subject: Leaky bucket algorithm
- From: David Aames <email@hidden>
- Date: Mon, 12 Jun 2006 13:57:37 +0100
Howdy,
As I implemented the token bucket algorithm a few days ago I was able
to cap the socket's _average_ upload and download rate. But there is
a problem - the traffic is all bursty. A sketch of my algorithm can
be seen here: http://img220.imageshack.us/img220/8697/
downloadalgo0al.png The problem with this approach is that e.g., 1024
bytes are transferred immediately after they go into the bucket and
the application stays idle for another remaining time until the
bucket is filled up again. So basically - max download speed:idle:max
speed:idle:... So I thought that I could put a leaky bucket to fix
this behavior. But in order for the leaky bucket to work properly (my
thoughts) it should leak a small amount quite a few times a second -
using a timer for this causes a lot of CPU usage so it's a no-go. Is
there a way of implementing the leaky bucket without having a timer
regulating the leaks? Currently my token bucket solution uses one
timer per socket but I could optimize this so I'm using just one
timer for all sockets - every socket will object a pointer to an
instance (singleton) and add itself to the internal list of that
object which will in turn fill up all the buckets in one go. But my
problem with the bursty traffic still remains. Any comments/
recommendations/pointers are greatly appreciated.
Regards
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden