# Traffic shaping (HTB) and latency

## Akaihiryuu

Ok, I have tried 2 different canned solutions to traffic shaping:  Wondershaper and FairNAT.  I'm having the exact same issue with both of them.  Basically, my ISP has great download speeds (20mbit+), but absolutely TERRIBLE upload speeds (384kbit at most).  Any amount of uploading at all tends to destroy the upstream bandwidth and cause latency as a result.  So I decided that traffic shaping was the way to go.  Wondershaper worked really well, FairNAT works even better.  They both seem to use HTB as their shaping method.

Anyway, the issue is this:  Even though I have measured my upload speed (it tends to max out at about 0.3-0.35mbit, very very rarely going as high as 512kbit), if I set either of these to use an upstream cap of about 384kbit, I get MASSIVE MASSIVE latency and packet loss (usually around 20% packet loss with around 300-500ms latency).  I've done tests on pingtest.net with shaping active and the results are absolutely horrid.  The weird thing is, it didn't always do this.  It was fine, for upward of a year (using Wondershaper)...then one day it suddenly wasn't.  So I went without shaping at all for awhile, then I discovered FairNAT and decided to give it a try.  It did the exact same thing as Wondershaper did.

So I had this strange idea to try setting my upstream bandwidth to 1mbit...did that, bang, latency and packet loss cleared right up.  Ran another upload test, got about 0.35mbit.  Set to 384 again, same packet loss.  Wondershaper does the exact same thing.  So my question is...what in the world could be causing this?  Is it something my ISP is doing?

----------

## PaulBredbury

Try some obvious tests, like setting to 100kbit - it should then be slow but stable.

The 384-ish value you set as the maximum, for shaping, must be below what your router is capable of, otherwise the bottleneck moves to your router.

Here's my config.

----------

## Akaihiryuu

 *PaulBredbury wrote:*   

> Try some obvious tests, like setting to 100kbit - it should then be slow but stable.
> 
> The 384-ish value you set as the maximum, for shaping, must be below what your router is capable of, otherwise the bottleneck moves to your router.
> 
> Here's my config.

 

I tried 100kbit...that gives me about 3000ms latency to anything I try.  Even DNS requests take forever.  However, I just happened to look at the switch, and there is pretty heavy traffic to my roommate's computer, so he might be torrenting.  I should probably try it again when there is no traffic to see what happens.

----------

