Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have server that runs a backup process (a bash script, actually) every hour. Part of this backup routine is to sync changes to a remote system (includes revision control, etc etc). This works great, takes almost no CPU or memory and is the perfect backup solution for this system.

However, the problem is that it exists on a very limited outbound bandwidth, and every hour the script locks up the system for 30-90 seconds (depending on how much needs to be synced up). It gets so bad that even when I'm using an SSH connection during the backup timeframe the terminal connection will lock up and take 5+ seconds to respond for every keystroke.

The Question: How can I limit the outbound bandwidth on a per-process, per-program, or per-script basis? If it makes a difference, I use Ubuntu server. Are there any utilities out that do this?

For extra credit, are there any C/C++ references on binding/owning network connections that I can use to create my own program? For example: Apache grabs port 80, but whenever it tries to send something out, my program would jump in and throttle the connection, in-between apache and the hardware-level network interface. Is this even possible?

(Note: I am willing to consider options that modify the linux kernel, but only if there is nothing else available).

share|improve this question

migrated from Apr 30 '12 at 4:38

This question came from our site for professional and enthusiast programmers.

Off topic; belongs on Server Fault – Ex Umbris Apr 11 '12 at 4:05
what's with the downvote? And why would it belong on Server Fault? I thought Stack Overflow was for asking programming-related questions – cegfault Apr 15 '12 at 5:08
up vote 1 down vote accepted

you should try ( light userspace bandwith limiting tool ) and ( a bandwidth limiting pipe ) , seems to be what you need .

share|improve this answer
I'll have to modify trickle a little bit to suit my needs, but it looks like it should work for me. Thanks! – cegfault May 19 '12 at 18:20

Check out nice, ionice, and

You could also look into a traffic shaping router on the network side.

If your backup program doesn't already do incrementals, compression and deduplication, you might want to look into that as well, to reduce the amount of bandwidth being pushed by the backup process(es).

share|improve this answer
The network transfer uses rsync, so I doubt I'll get much better with that. Even with compression, it's still anywhere from a few hundred MB to a few GB of data that needs to be transmitted. Maybe I should be asking about software-level QoS utilities? – cegfault Apr 15 '12 at 5:12

Your Answer


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.