Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

It's fairly easy to use tc with Stochastic Fairness Queueing (SFQ) to configure fair bandwidth sharing between flows, but an application can open multiple flows and get an unfair share of bandwidth. Is it possible to configure fair bandwidth sharing between applications instead?

Grouping each application into a cgroup seems like a clear first step. If SFQ supported hashing on the class ID, it would be easy to use tc filter to assign each cgroup a class ID. Unfortunately, SFQ doesn't seem to support this. Another promising approach is to use CBQ, which does Weighted Round Robin across classes. Unfortunately, making the weights all equal doesn't seem to work.

Is there another way to fairly share bandwidth between cgroups?

share|improve this question

1 Answer 1

Check out net_cls cgroup controller. It basically attaches special tag (defined in /mntpoint/net_cls.classid to each packet that originates on socket associated with an application in that cgroup. You can later use this 'tag' as classid in the filter attached to the qdisc to pass the traffic to different classes based on the cgroup the traffic comes from.

The only documentation I've found on this topic are some Red Hat slides [HTML via Google].

share|improve this answer
    
Thanks for your answer! I had in fact found the net_cls subsystem, but what I'm wondering is what qdisc to use in order to classify the traffic appropriately. –  Ankur Dave Jun 28 '11 at 4:13
    
You need classfull qdisc, so your options are HTB, CBQ and PRIO. I'm not an expert here, but as far as I can tell, HTB provides the same flexibility as CBQ while being much easier to configure. From the description, I doubt PRIO makes sense with net_cls. –  Petr Uzel Jun 28 '11 at 6:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.