Ideas for a Linux solution to use as much of 95th percentile bandwidth as possible?

Update: I'm looking for an automated "95th percentile bandwidth limiter". I was originally hoping for something part of the traffic shaping code in the kernel but I think it doesn't exist. I'm aware that I can manually limit at 3Mbps and be safe, but that would be wasting a lot of bandwidth that I could be using.

Original:

Let's assume I have a set of co-located servers and I pay for 3Mbps at 95th percentile. I would like to use as much of that as possible without incurring overage charges. Without any throttling, the servers would generate 10Mbps of traffic, leading to overage charges. What I'm asking is for something that would not throttle at all for 5% of the time becuase the 95th percentile billing rules will throw those out, while keeping me under the 3Mbps the rest of the time.


Solution 1:

If you're using linux, check out the Linux Advanced Routing and Traffic Control HOWTO for an introduction on how to use tc and other tools to perform traffic shaping and qos on your link.

There are management systems for tc which abstract away some of the pain, such as MasterShaper and WonderShaper. I've not used either of those, and wondershaper appears to be very poorly maintained, but you might get some use out of them.

Or you can use a bundled firewall/management system like pfsense, m0n0wall, etc.

For a simple task like setting a single cap on traffic, I'd just write a tc script using the LARTC howto though.

And finally, if you want to monitor your link usage to keep a visual and historical record of your utilisation (and your 95th percentile mark), use a tool like cacti or munin to visualise it.