[LARTC] Any danger in thrashing 'tc'?

David McNab david@rebirthing.co.nz
Fri, 12 Mar 2004 15:44:25 +1300


Hi,

Is there any danger in a prog which repeatedly clears the ingress and 
root egress qdiscs, and sets up new ones, even as frequently as every 
5-15 seconds?

I'm writing a shaper app which dynamically shapes traffic on some weird 
attributes such as:
  * country of remote peer
  * program on local machine (and/or each program's arguments)

The objective is to apply limits to any overseas traffic to/from 
long-running p2p apps, such as I2P and Freenet, to help ADSL users in NZ 
prevent blowing their 'overseas traffic caps' and getting hit with nasty 
bills.

It's based on a loop which:
* does a netstat
* reads /proc/[pid] to get the dirt on each program with an active
   TCP connection
* runs a set of tests (matching for programs to traffic-shape, and how
   they should be traffic-shaped)
* derives from all this a set of ingress and root egress shaping rules
* clears the ingress and root egress qdisc, and fires off n tc commands
   to implement the shaping which is needed in the moment.

As you can see, the prog will be frequently spitting heaps of tc 
commands, constantly taking down the ingress and root egress qdiscs, and 
creating new ones.

So, am I likely to hit on any unintended consequences (apart from the 
minor cpu spikes)?

Thx in advance for your insights.

-- 

Kind regards
David

--

leave this line intact so your email gets through my junk mail filter