Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 1 Nov 2000 10:41:47 -0800 (PST)
From:      Luigi Rizzo <rizzo@aciri.org>
To:        imp@village.org (Warner Losh)
Cc:        net@FreeBSD.ORG
Subject:   Re: Traffic throttling
Message-ID:  <200011011841.KAA14837@iguana.aciri.org>
In-Reply-To: <200011011718.KAA16816@harmony.village.org> from Warner Losh at "Nov 1, 2000 10:18:28 am"

next in thread | previous in thread | raw e-mail | index | archive | help
Hi,

from your description i suppose the ISP takes 5min traffic averages,
and then stores the 5% highest ones (which is 432 samples), and
the smallest one of this set is the bw for which you are charged.

For your purposes
you might use a script which periodically (every 1-2.5-5min ?)
fetch&reset the counters associated with the ipfw rule
intercepting traffic to your upstream isp, stores the
samples somewhere, and whenever the limit is approaching
reconfigures the pipe associated with the rule.

I see only a few problems with this:

 - we do not a way to atomically fetch&reset the counters
   associated with a given ipfw rule. So you might err
   in some cases and miss some packets;
   But the atomic fetch&rst could be easily implemented;

 - you might err by a factor of 2 if your sampling is not
   synchronised with the ISP (this means you probably have
   to use shorter sample intervals);

and last not least

 - when your ISP will realize that the 5percentile of the samples
   really accounts for 90% of your total traffic, i suppose
   they will find some way to change your contract :)

	cheers
	luigi
   

----------------------------------+-----------------------------------------
 Luigi RIZZO, luigi@iet.unipi.it  . ACIRI/ICSI (on leave from Univ. di Pisa)
 http://www.iet.unipi.it/~luigi/  . 1947 Center St, Berkeley CA 94704
 Phone: (510) 666 2927
----------------------------------+-----------------------------------------
> Greetings net list.  I hope this is the right place to ask.
> 
> Our upstream ISP charges us based on how much bandwidth we use at the
> 95th percentile.  We want to limit the bandwidth that we use so that
> we consistantly come in at a certain level.  One trivial way to do
> this would be:
> 	ipfw pipe 1 config bw 32Kbit/s
> which would guarantee, more or less, that we never exceed 32kpbs.
> 
> However, the 95th percentile measurement that our isp does is the 95th 
> percentile of the 5 minute averages of usage.  there's no reason we
> couldn't use 200kbps of our pipe for 1 minute to download a port
> distribution and let the other 4 minutes go relatively idle.  For that 
> matter, 5% of the 5 minute time slices is 432 of them.  These samples
> are eliminated from consideration, so it doesn't matter what they
> are.  Last night I used 20 of them to update all my source trees from
> since before BSDcon via cvsup and rsync (depending on the
> project). :-)
> 
> After looking at the logs for a few weeks, I think that even a simple
> 	ipfw pipe 1 config bw 64Kbit/s
> would cover our butts, but again we're left with the desire to push
> the envelope further than this.
> 
> Now to my question, what's the best way to throttle things based on
> the above rules so that each month we are guarnateed (or nearly so) to 
> have our 95th percentile of usage be below a certain level.  I know
> the answer will likely involve thinks like "divert" and "write a
> deamon to" but if anybody had any suggestions for how to proceed, I'd
> love that.  Maybe someone has already written such a tool, but I fear
> I'll need to write it.
> 
> Warner
> 
> 
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-net" in the body of the message
> 



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-net" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200011011841.KAA14837>