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

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 stackoverflow.com 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
1  
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

2 Answers 2

up vote 1 down vote accepted

you should try http://monkey.org/~marius/pages/?page=trickle ( light userspace bandwith limiting tool ) and http://klicman.org/throttle/ ( 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 http://stromberg.dnsalias.org/~strombrg/slowdown/

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

 
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.