Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm looking for something like nice for cpu, but for network usage that will limit application network consumption to level that will configure.

I have problems with xapian-replicate-server that is consuming 80 % of my network. It's causing mysql connections problem (mysql server is working on this machine too). I can't move xapian or mysql to other machine so i need to limit xapian network usage to a decent level.

Is there any tool that will help me do this ?

share|improve this question
    
Most managed switches (even low-cost ones) feature QoS so that you can prioritize traffic. –  gravyface Apr 24 '12 at 10:49
    
This is an old example with iproute and iptables (you may have netfilter already but it should be similar): lartc.org/howto/lartc.cookbook.fullnat.intro.html –  ott-- Apr 24 '12 at 10:58
    
But, netfilter == iptables? –  Kyle Smith Apr 24 '12 at 11:24

2 Answers 2

up vote 6 down vote accepted

tc, iptables etc can all do this, but just to be different:

You can use Linux kernel feature cgroups and its net_cls module for limiting xapian-replicate-server. Something like this should do:

mount -t cgroup -onet net /sys/fs/cgroup
cd /sys/fs/cgroup
mkdir xapian-replicate-server
/bin/echo $$ > xapian-replicate-server/tasks
/bin/echo 2048 > xapian-replicate-server/net.tcp
/bin/echo 4096 > xapian-replicate-server/net.tot
however_you_launch_xapian-replicate-server

This would create a new cgroup for Xapian and give it total of 2048 kilobytes/s TCP traffic bandwidth and 4096 kilobytes/s of total whatever network traffic bandwidth.

share|improve this answer
    
You should mount the cgroup filesystem under /sys/fs/cgroup/net_cls if your distribution does not already do so. –  Sam Morris Apr 24 '12 at 11:07
    
@Sam Morris: Oops! Fixed my comment :) –  Janne Pikkarainen Apr 24 '12 at 11:30
1  
This cgroup no longer functions that way. You need to add a series of qdiscs, classes and filters and then mark the class you want that cgroups traffic to go into with net_cls.classid –  Matthew Ife Oct 18 '13 at 20:58

Seems like "trickle" could work for you: http://monkey.org/~marius/trickle/

share|improve this answer

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.