# ALTQ - Does this make sense?



## mlager (May 15, 2012)

I've got a FreeBSD host that has a public address assigned to bge0. I have a webserver running on port 80 that is providing an HTTP mirror for one of my buddies. I've got 5Mbits available on this system. What I'm trying to do is cap the mirror at 1Mbit for port 80 and give the rest of the system 4Mbits. When the mirror isn't being utilized, the system would have access to the full 5Mbits by borrowing from the mirror queue.

Here is the queue I have set up. It seems to be working but I have a funny feeling this isn't ideal. When downloading from the mirror I get a download speed of about 120 KB/s which is approx 1Mbit which tells me the cap is working. I don't seem to get the full 5Mbit from the rest of the host even when the mirror is idle.


```
altq on bce0 cbq bandwidth 5Mb queue { default, mirror }

queue default bandwidth 4Mb priority 1 cbq(default borrow)
queue mirror bandwidth 1Mb priority 7
```

I apply the queue only on my "pass in" line where I allow in traffic to port 80. The rest will fall under the default queue.

Any suggestions would be great!


----------



## bbzz (May 15, 2012)

CBQ is not that accurate, and requires more fine tunning. You want to try HFSC.


----------



## DutchDaemon (May 15, 2012)

You need to instruct the _child_ to borrow. You haven't set the child to actually borrow from the parent now. In fact, the parent should not have the borrow directive at all, only child queues need it. The parent will automatically allow borrowing when a child queue has this directive set. If the parent needed such a directive, it would be called lend 


```
The cbq scheduler supports an additional option:

     borrow      The queue can borrow bandwidth [I]from the parent[/I].
```


----------

