All of lore.kernel.org
 help / color / mirror / Atom feed
* HTB limiting working for single big download but not for many small ones
@ 2013-02-07 17:57 Dennis Jacobfeuerborn
  2013-02-08 11:07 ` Dennis Jacobfeuerborn
  2013-02-08 11:39 ` Dennis Jacobfeuerborn
  0 siblings, 2 replies; 3+ messages in thread
From: Dennis Jacobfeuerborn @ 2013-02-07 17:57 UTC (permalink / raw)
  To: lartc

Hi,
I've run into problems trying to limit the overall download bandwidth for a
webserver. This is the code I'm using:

tc qdisc add dev eth0 root handle 1: htb default 30
tc class add dev eth0 parent 1: classid 1:1 htb rate 200mbit ceil 200mbit
tc filter add dev eth0 protocol ip parent 1:0 prio 1 u32 match ip sport 80
0xffff flowid 1:1

The problem is that when I test this with a single connection downloading a
large file I can see the download speed according to the specified limit
(in this case 200mbit).
When I use this code on a production system that receives several thousand
small downloads from an nginx server however I see the following:

# tc -s -d class show dev eth0
class htb 1:1 root prio 0 quantum 200000 rate 200000Kbit ceil 200000Kbit
burst 101600b/8 mpu 0b overhead 0b cburst 101600b/8 mpu 0b overhead 0b level 0
 Sent 246544581544 bytes 55302789 pkt (dropped 1614680, overlimits 0
requeues 0)
 rate 636728Kbit 16228pps backlog 0b 229p requeues 0
 lended: 55302560 borrowed: 0 giants: 51516908
 tokens: -3729 ctokens: -3729

The rate is over 600mbit so I'm not sure why the traffic isn't limited to
the 200mbit specified. Is there something else I need to take into account
here to make this work?

Regards,
  Dennis

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: HTB limiting working for single big download but not for many small ones
  2013-02-07 17:57 HTB limiting working for single big download but not for many small ones Dennis Jacobfeuerborn
@ 2013-02-08 11:07 ` Dennis Jacobfeuerborn
  2013-02-08 11:39 ` Dennis Jacobfeuerborn
  1 sibling, 0 replies; 3+ messages in thread
From: Dennis Jacobfeuerborn @ 2013-02-08 11:07 UTC (permalink / raw)
  To: lartc

On 02/07/2013 06:57 PM, Dennis Jacobfeuerborn wrote:
> Hi,
> I've run into problems trying to limit the overall download bandwidth for a
> webserver. This is the code I'm using:
> 
> tc qdisc add dev eth0 root handle 1: htb default 30
> tc class add dev eth0 parent 1: classid 1:1 htb rate 200mbit ceil 200mbit
> tc filter add dev eth0 protocol ip parent 1:0 prio 1 u32 match ip sport 80
> 0xffff flowid 1:1
> 
> The problem is that when I test this with a single connection downloading a
> large file I can see the download speed according to the specified limit
> (in this case 200mbit).
> When I use this code on a production system that receives several thousand
> small downloads from an nginx server however I see the following:
> 
> # tc -s -d class show dev eth0
> class htb 1:1 root prio 0 quantum 200000 rate 200000Kbit ceil 200000Kbit
> burst 101600b/8 mpu 0b overhead 0b cburst 101600b/8 mpu 0b overhead 0b level 0
>  Sent 246544581544 bytes 55302789 pkt (dropped 1614680, overlimits 0
> requeues 0)
>  rate 636728Kbit 16228pps backlog 0b 229p requeues 0
>  lended: 55302560 borrowed: 0 giants: 51516908
>  tokens: -3729 ctokens: -3729
> 
> The rate is over 600mbit so I'm not sure why the traffic isn't limited to
> the 200mbit specified. Is there something else I need to take into account
> here to make this work?

I've now experimented with burst/cburst but either I end up with a rate way
below 200mbit or easily exceeding 600mbit. Apparently the actual 200mbit
limit is just ignored.

Regards,
  Dennis

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: HTB limiting working for single big download but not for many small ones
  2013-02-07 17:57 HTB limiting working for single big download but not for many small ones Dennis Jacobfeuerborn
  2013-02-08 11:07 ` Dennis Jacobfeuerborn
@ 2013-02-08 11:39 ` Dennis Jacobfeuerborn
  1 sibling, 0 replies; 3+ messages in thread
From: Dennis Jacobfeuerborn @ 2013-02-08 11:39 UTC (permalink / raw)
  To: lartc

On 02/08/2013 12:07 PM, Dennis Jacobfeuerborn wrote:
> On 02/07/2013 06:57 PM, Dennis Jacobfeuerborn wrote:
>> Hi,
>> I've run into problems trying to limit the overall download bandwidth for a
>> webserver. This is the code I'm using:
>>
>> tc qdisc add dev eth0 root handle 1: htb default 30
>> tc class add dev eth0 parent 1: classid 1:1 htb rate 200mbit ceil 200mbit
>> tc filter add dev eth0 protocol ip parent 1:0 prio 1 u32 match ip sport 80
>> 0xffff flowid 1:1
>>
>> The problem is that when I test this with a single connection downloading a
>> large file I can see the download speed according to the specified limit
>> (in this case 200mbit).
>> When I use this code on a production system that receives several thousand
>> small downloads from an nginx server however I see the following:
>>
>> # tc -s -d class show dev eth0
>> class htb 1:1 root prio 0 quantum 200000 rate 200000Kbit ceil 200000Kbit
>> burst 101600b/8 mpu 0b overhead 0b cburst 101600b/8 mpu 0b overhead 0b level 0
>>  Sent 246544581544 bytes 55302789 pkt (dropped 1614680, overlimits 0
>> requeues 0)
>>  rate 636728Kbit 16228pps backlog 0b 229p requeues 0
>>  lended: 55302560 borrowed: 0 giants: 51516908
>>  tokens: -3729 ctokens: -3729
>>
>> The rate is over 600mbit so I'm not sure why the traffic isn't limited to
>> the 200mbit specified. Is there something else I need to take into account
>> here to make this work?
> 
> I've now experimented with burst/cburst but either I end up with a rate way
> below 200mbit or easily exceeding 600mbit. Apparently the actual 200mbit
> limit is just ignored.

So after further digging I finally stumbled upon the solution. The reason
this wasn't working is that I'm running this in a xen guest and apparently
the tx checksum offloading screws things up. I removed the burst/cburst
options again and instead issued a "ethtool -K eth0 tx off" and now the
traffic is limited at the expected 200mbit.

Regards,
  Dennis


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-02-08 11:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-07 17:57 HTB limiting working for single big download but not for many small ones Dennis Jacobfeuerborn
2013-02-08 11:07 ` Dennis Jacobfeuerborn
2013-02-08 11:39 ` Dennis Jacobfeuerborn

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.