This question is similar to this: How do I limit internet bandwidth?. But the wondershaper
and trickle
cannot limit internet bandwidth for already started applications. So, how can I limit internet bandwidth for already started applications(but only for one application, not for whole system)? :)
For the general case, it is theoretically possible in the kernel, using the owner extension to netfilter. I can see the option
--pid-owner
on the man page ofiptables
on die.net, but it says it is broken with SMP :(In my own system, a 10.04, there is no such option on the manual :( . So I believe we are out of luck this time ;( . Maybe there will be another incarnation of the
--pid-owner
option some time in the future. A gui on top of that would not be rocket science.The first step must be taken on Linux itself and iptables.
As for more specific types of traffic, such as HTTP. There should be ways to make accommodations using proxies, but it probably needs some hacking because this use-case does not arise often.
It's not particularly helpful, but the only way (I know of) to truly limit bandwidth effectively is using packet shaping or queuing technology. The only truly well-thought-out method I'm aware of is the PacketShaper range of appliances now owned by Bluecoat.
I haven't used them myself in quite a few years, but I use Bluecoat proxies daily so I've kept up with the development of the PacketShaper range.
They're expensive, but truly superb at what they do. They don't use queues at all - they manipulate the TCP windows size dynamically to throttle bandwidth on a tcp-pair conversation. In the latest releases, they're application aware too, so you can say "throttle iPlayer and Youtube, but let everything else through".
I'm scratching the surface of these devices capability really, but I'll stop since they're not relevant to Ubuntu, so I'm afraid that this answer isn't fully relevant.
I didn't try this, but this should work...
Bandwidth-Limiting-HOWTO