Carl Hutzler’s Blog

Photography, Technology Musings, and other Completely Random Thoughts. Hey, it’s free.

Traffic Shaping and Off-site Backups

Wanted to add one more thing to the story on how to do off-site backups using RSYNC. Once you get the set-up running you may find that some of your back-ups run into the day time hours. This can interfere with the speed of your Internet access as the back-up will typically use 99% of the uplink pipe at your house. (Don’t worry about your friend’s house as their download link will hardly be affected by the traffic since downlinks are usually 5-10x faster).

If you uplink is saturated with RSYNC traffic, it will be difficult to get your mail, browse the web or related things. I mean these things will still work, but they will have a lot of latency. Even if you are just trying to DOWNload a file, it will be slow as the file transfer does require a small amount of uplink capacity for ACKs and similar traffic.

So we need a way to allow the rest of the machines on the internal network to have full use of the uplink path while still allowing the RSYNC backups to happen. We could just constrict the RSYNC traffic to a small percentage of the uplink path but it is actually just as easy to dynamically allow other hosts to use what they need, when they need it. In this way the other hosts have a priority over the rsync traffic. So when the other hosts are idle, rsync goes as fast as it can. But when I want to do some work, rsync takes a back seat to my traffic.

Luckily doing this with a DD-WRT flashed router is fairly simply. You go into the NAT/QOS tab and the QOS sub-tab and do all the settings in that area. Basically you have to tell the router what your uplink and downlink speeds are in the first place….what does your broadband company cap you at. For me, it is 1.5Mbps (bits per second) uplink and I think 8Mbps downlink. Check here for your speed if you don’t know it. You will want to enter about 90-95% of the max numbers.

Anyway, after you program these figures (as Kbps so divide by 1000), you move on to the other areas. The first thing I did was configure a new protocol called RSYNC on TCP port 873. I prioritized this as BULK which is the lowest priority. Then I added in a number of common protocols we use in the house which are pre-configured in the DD-WRT software. I made all of these the highest priority which is EXEMPT. I went one step further and fully exempted the MAC Address of my primary work machine from all traffic shaping (just in case I forgot a specific protocol).

After hitting apply, any NEW TCP connections will have the traffic shaping applied to them. Be aware that if you are doing this WHILE an RSYNC backup is ongoing, the changes you make will NOT affect the current TCP connection.

Below is a graph which shows the RSYNC backup traffic running at a max of about 1.66 Mbps. The dips in traffic are due to an FTP upload that I started and stopped and started again. Basically the FTP gets priority over the rsync when it needs it.

graph of lan traffic shaping

Below are my configs in DD-WRT (click for larger)

DD-WRT traffic shape

No comments yet. Be the first.

Leave a reply

Mexico