Gentoo Archives: gentoo-user

From: Hans-Werner Hilse <hilse@×××.de>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Using SFQ for fair bandwidth alocation on servers
Date: Wed, 20 Jun 2007 15:46:54
Message-Id: 20070620174121.3a66b7d1.hilse@web.de
In Reply to: [gentoo-user] Using SFQ for fair bandwidth alocation on servers by Daniel van Ham Colchete
1 Hi,
2
3 On Wed, 20 Jun 2007 11:15:04 -0300
4 "Daniel van Ham Colchete" <daniel.colchete@×××××.com> wrote:
5
6 > I have a collocation server with a 2 Mbps bandwidth for my e-mail. I would
7 > like to use SFQ to do a more fair split of this bandwidth between my users
8 > (~500). I think SFQ is a very good idea: it will split the available
9 > bandwidth between the current connections (almost) equally, and it's CPU
10 > cheap.
11
12 Yep. But remember: Connections, not users.
13
14 > The problem is: from what I could read, SFQ can only read the available
15 > bandwidth from the physical layer. Is it possible to tell SFQ something like
16 > "I only have 2 Mbps, and not 100 Mbps, from eth0"?
17
18 I didn't read anywhere it needs a bandwith parameter at all. And I
19 think it really doesn't. From what I read in the
20 source, /usr/src/linux/net/sched/sch_sfq.c, it merely just distributes
21 incoming packets equally and it really only gets in between if the
22 enqueuing rate exceeds the dequeuing rate -- by means of absolute
23 packet buffer numbers, that is.
24
25 In that case, using a TBF before giving packets to the SFQ would
26 probably serve well. Also, you might want to use SFQ only for some
27 connections, e.g. give precedence to DNS queries or similar stuff.
28
29 Just put a TBF as root discipline, like (untested):
30 $ tc qdisc add dev eth0 root handle :1 tbf rate 1920kbit latency 50ms burst 4096
31 and then set up a SFQ discipline:
32 $ tc qdisc add dev eth0 parent 1:1 sfq
33
34 If OTOH you decide to use PRIO scheduling for interactive traffic, you
35 can probably fully replace the TBF by the HTB discipline and use SFQ at
36 the ends of the subclasses.
37
38 -hwh
39 --
40 gentoo-user@g.o mailing list