Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Dec 2011 21:51:39 -0500
From:      Maxim Khitrov <max@mxcrypt.com>
To:        FreeBSD <freebsd-questions@freebsd.org>
Subject:   Implementation details of altq hfsc scheduler in pf 4.5
Message-ID:  <CAJcQMWcu38hiMTJKnW=SbEWBXzQ0ZvDMWA=jcyJ1dP2r5xieww@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
I've read everything I could find on the topic of configuring hfsc
altq in pf (4.5, FreeBSD 9), but I still have no clear idea of how it
is actually implemented. I even started looking through the source
code, but that might take a while. My main questions are:

1. Difference between 'realtime' and 'linkshare'?
2. In service curve configuration (m1, d, m2), what is 'd' relative to?
3. Are priorities actually used for anything?

For question 1, both settings seem to set a minimum guarantee. What is
their relationship? For example, what will be the behavior of the
following configuration:

altq on $wan hfsc bandwidth 25Mb queue {one, two}
queue one bandwidth 70% hfsc(default, realtime 20%)
queue two bandwidth 30% hfsc(realtime 60%)

I know that the sum of realtime options cannot exceed 80% and that
'bandwidth' is an alias for 'linkshare' when using a linear service
curve (m2). So the question is, how will this configuration behave as
both queues start to exceed their realtime allocations (total traffic
is consuming more than 20Mb of bandwidth)?

Question 2 comes out of the following phrase, which is repeated almost
verbatim on every site I found:

"For the first d milliseconds the queue gets the bandwidth given as
m1, afterwards the value given in m2."

First 'd' milliseconds starting from when? Is it per-connection (i.e.
time when the state is created)? That's what everyone seems to imply,
but it's a per-queue configuration option ("the queue gets..."). Who
gets what and when? How is the bandwidth shared between multiple
connections, started at different times, within the same queue?

Suppose I change my configuration as follows:

altq on $wan hfsc bandwidth 25Mb queue {std, web}
queue std bandwidth 70% hfsc(default, realtime 60%)
queue web bandwidth 30% hfsc(realtime (20%, 10000, 10%))

Queue 'std' will be used for all general outgoing traffic and is
currently being fully utilized (at 25 Mb/s). Queue 'web' will be used
for traffic from my web server. At T=0, a client outside of my network
connects to the web server and begins downloading a large file.

I assume that the 'std' queue is now throttled back to 70%, and the
web client will receive about 30% of the total bandwidth. Is it the
case that at T=10 seconds, the web traffic is reduced from 30% to 10%
and std traffic goes up to 90%? This also goes back to the
relationship between realtime and linkshare. The 'std' queue is only
guaranteed 60%, no?

Next, what happens if a second web client connects at T=15 seconds and
begins downloading the same file? You now have packets for two
separate connections, which were started at different times, being
queued in 'web' with a non-linear service curve. What will each client
receive (in terms of bandwidth) and when?

Finally, the purpose of queue priorities is also not clear. Some sites
advise to leave them out because hfsc relies entirely on bandwidth
limits, while others specify priorities in a fashion similar to priq.
What is actual effect of different queue priorities on hfsc
scheduling?

- Max



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAJcQMWcu38hiMTJKnW=SbEWBXzQ0ZvDMWA=jcyJ1dP2r5xieww>