Calculating the required bandwidth for ACK queues for asymetric link
-
Adaptive traffic shaping? Would be great. There is a software named QoSbox that change linkshare dynamically. Maybe you'll find it helpful. For more details, refer to http://www.cs.virginia.edu/~mngroup/projects/qosbox/docs.html.
In the context of ACK queues in HFSC, however, I think it's not so hot topic. Because it's almost surely harmless assigning some large value (say, 60%) to qWANack linkshare or realtime curve's m1. If that bandwidth is needed, it's used. Otherwise it is allocated to other traffics.
Just my opinion.
–----
to hoba, sullrich: spreadsheet sent. -
Sounds great. You seem to know a lot more about HFSC than we do. Want to adopt our code? :)
-
Attaching the spreadsheet mentioned prior in this thread.
-
the outcome of this topic sounds really interesting and potentially very useful :)
best of luck -
Hi, please help me! How much set LAN ack and WAN ack (into percent) for DSL line Upload 512Kbps and Download 8192Kbps. (asymetric line).
Very thanks!!! -
Hi, please help me! How much set LAN ack and WAN ack (into percent) for DSL line Upload 512Kbps and Download 8192Kbps. (asymetric line).
Very thanks!!!Download the excel document and plug your values in.
-
where find cell for LAN ans WAN ack? I am not uderstand this sheet :-(
Thanks!
-
A (UP)
B (DOWN) -
Then
- click Tools/Solver…
- click Set Target Cell, click R15C12 (or R16C12), click Max, click Solve
- click Keep Solver Solution, click OK
The required X [kb/s or mb/s] is shown in R15C12. The required X/A [%] is shown in R16C12.
-
dusan can you please explain the rationale behind this in a formal way.
I want to integrate this in the shaper wizard and the excel is not easily readble/understandable.
Thanks in advance.
-
Well here's an explaination which – I hope -- is more detailed and formal.
All symbols are defined as before but we rather sumarize them here:
A = bandwidth of qWANroot
B = bandwidth of qLANroot
C = bandwidth of qWANdef
D = bandwidth of qLANdef
X = bandwidth of qWANack
Y = bandwidth of qLANackIn this model, we make use of no other queues:
A = C + X
B = D + Y(To be exact, we know A, B and don't know C, D, X, Y. The analysis shows how much qWANack and qLANack could be actually utilized assuming they may be as large as needed, i.e. unbounded by anything else than A and B, respectively, that's what would be taken as the required value for X and Y and the rest of A and B would simply become C and D, respectively.)
Consider a single, i-th, traffic. The traffic varies in time, and utilizes four queues qWANdef, qLANdef, qWANack and qLANack at the same time. However, assuming that for the traffic, the four queue utilization "amounts" are directly related (rather than independent) by some constant coefficients (c_i,d_i,x_i,y_i), we represent the traffic "activity" as a single variable (v_i) rather than four. For example, for i=5 (Web surf traffic), the queue utilization "amounts" are assumed to be (v5c5, v5d5, v5x5, v5y5) at every time. The vector (c5, d5, x5, y5) = (0.135, 1, 0.0375, 0.0125), which is assumed constant for every network with any ratio of asymmetricity, is called Web surf traffic pattern.
(The assumption is supported by experimental observation. At time t in network N, it was observed that the qWANdef, qLANdef, qWANack, qLANack utilization "amounts" are
0.135, 1, 0.0375, 0.0125 [kb/s], respectively
and at time t' in network N', it was observed that the four queue utilization "amounts" are
135, 1000, 37.5, 12.5 [kb/s], respectively.
The experiments were made under Web surf traffic solely and no others involved, of course.)
The spreadsheed makes use of 8 traffic patterns, indexed by 0 through 7.
For every i in 0…7, let
a_i = c_i + x_i
b_i = d_i + y_iAt every time, the qWANdef utilization is
v0 * c0 + ... + v7 * c7
the qWANack utilization is
v0 * x0 + ... + v7 * x7
the qWANroot (ie. uplink) utilization is the sum of the two above:
(v0 * c0 + ... + v7 * c7) + (v0 * x0 + ... + v7 * x7)
= (v0 * c0 + v0 * x0) + ... + (v7 * c7 + v7 * x7)
= v0 * (c0 + x0) + ... + v7 * (c7 + x7)
= v0 * a0 + ... + v7 * a7the qLANdef utilization is
v0 * d0 + ... + v7 * d7
the qLANack utilization is
v0 * y0 + ... + v7 * y7
the qLANroot (ie. downlink) utilization is the sum of the two above:
(v0 * d0 + ... + v7 * d7) + (v0 * y0 + ... + v7 * y7)
= (v0 * d0 + v0 * y0) + ... + (v7 * d7 + v7 * y7)
= v0 * (d0 + y0) + ... + v7 * (d7 + y7)
= v0 * b0 + ... + v7 * b7Now we can construct a system of inequations, each represents a constraint, of 8 unknowns v_0 through v_7.
Uplink utilization must not exceed uplink bandwidth:
(C1) v0 * a0 + ... + v7 * a7 <= A
Downlink utilization must not exceed downlink bandwidth:
(C2) v0 * b0 + ... + v7 * b7 <= B
All network traffic must be non-negative:
(C3) v_i >= 0
Additional constraints may be made. For example, if we know that p2p uploading are upper-limited by 80% uplink bandwidth then we may add the constraint:
(C4) v0 * c0 <= A * 0.8
Similarly, if we know that p2p downloading are upper-limited by 80% downlink bandwidth then we may add the constraint:
(C5) v1 * d1 <= B * 0.8
The bounds like A and B are to be filled as values in row 3 of the Excel spreadsheet. The bounds like A0.8 and B0.8 are pre-filled as formulars in columns 8 and 9 of the sheet.
The MS Excel Solver find a solution of (C1)-(C5) that maximize a user-selected target cell. Note that we are concerned of queues' utilization implied from the solution, not the solution itself. Of particular interest may be the utilization of qWANack, qLANack, uplink and downlink. The spreadsheet includes formulars for them. We can select one of them as the target and observe others as the implied consequence.
As I've said, the Excel is for the purpose of analysis. It's not suitable and not worth to integrate in the Wizard as such.
-
A = interface/tocken bucket bandwidth
c = observed from the samples.
x = observed from the samples.SO you are saying that the basic equation for a queue is:
A >= c*x (if we have a single queue under A).and it transforms to
A >= sum(c_i* x_i) (for i queues).
and each queue gets c_i + x_iIf that is right and one wants to write a daemon that start by the assumtion of the constants calculated/observed by your testings and smaples traffic to adjust the i queues accordingly how can one calculate the c_i/x_i to be used later on a new calculation.
Basically can you provide even the calculation for the variables so one can write such a daemon?!I hope to have understood your explanation. The rationale of integrating this with the wizard is to be coupled with such a daemon to make sense.
By the way thanks for your quick reply.
-
A = interface/tocken bucket bandwidth
c = observed from the samples.
x = observed from the samples.SO you are saying that the basic equation for a queue is:
A >= c*x (if we have a single queue under A).I am not sure if we are using the same symbol definition. My equations doesn't say anything about c*x, only c+x.
And given only one [sub-]queue under qWANroot, there exists either c or x, but not both.and it transforms to
A >= sum(c_i* x_i) (for i queues).
and each queue gets c_i + x_iNeither i was defined to be the number of queues, or the index of a queue. It was defined to be the index of a traffic (or, to be precise: a type of traffic). We use four [leaf-level] queues and eight [types of] traffic. The 48 matrix is enough to estimate largest qWANack utilization. You can extend it to, say, 14500 if you see any benefit of the extension and have a good traffic analyzer (see below).
If that is right and one wants to write a daemon that start by the assumtion of the constants calculated/observed by your testings and smaples traffic to adjust the i queues accordingly how can one calculate the c_i/x_i to be used later on a new calculation.
Basically can you provide even the calculation for the variables so one can write such a daemon?!I hope to have understood your explanation. The rationale of integrating this with the wizard is to be coupled with such a daemon to make sense.
I interpret that such a daemon should
-
analyze traffics to determine their patterns, and
-
optimize linkshare setup using the traffic patterns determined.
As for 1), with firewall's (at the transport and/or the application layer) service we can parse every packet and determine the traffic it belongs to. Packet classification would enable statistical analysis. Based on the analysis we can observe patterns, if any exists in any sense. So the problem is solved, in principle.
As for 2), however, one may cast question: what is the objective, the goal, the target, or the criteria of such an optimization?
-
-
Heh i misunderstood you.
So what you're saying is that your is just an approach based on values observed for a specific traffic and specific config?!
I thought it was some generalized schema to achieve this.
For 1) i concur it is easily solvable.
2) is just providing an adaptive shaping to the patterns/classes of traffic the user selects.think in terms of RSVP which wants for a specific class reserved traffic.
What i wanted to accomplish was just pessimization or optimization of traffic in behalf of the consumer.
Say you want that if the web traffic increases by 10% and at the same time VoIP traffic does the same we choose to serve VoIP better and pessimize the web traffic. -
Heh i misunderstood you.
So what you're saying is that your is just an approach based on values observed for a specific traffic and specific config?!
I thought it was some generalized schema to achieve this.
Play with the spreadsheet, then try other traffic patterns, play with it again and draw your own conclusion.
For 1) i concur it is easily solvable.
Me too. I just said that it is principally solvable.
- is just providing an adaptive shaping to the patterns/classes of traffic the user selects.
think in terms of RSVP which wants for a specific class reserved traffic.
What i wanted to accomplish was just pessimization or optimization of traffic in behalf of the consumer.
Say you want that if the web traffic increases by 10% and at the same time VoIP traffic does the same we choose to serve VoIP better and pessimize the web traffic.That's not an optimization. That's a static (and simple) policy. I see no need to adaptively change the linkshare or realtime service curves. Construct static curves preferring VoIP and pfSense will do the rest for you.
Btw, I don't think there could be a smart deamon that knows what user wants. User must express his/her needs, i.e. shaping policy, in terms of service curves. That's user's job, not the deamon's one.
-
Yeah but i cannot teach HFSC or CBQ to anybody in the forum and they need some backroung to undertand/control their behaviour. This daemon configurable by the user would at least make it easier for home users to get right and get me some statistical data to generalize the configuration from a wizard.
-
Then the wizard/daemon should simulate the policy-making-and-adjusting process of an exprerienced user, right? That seems to be a different approach (as opposed to optimalization). It's more practical and simpler to implement.
-
We get rid of the need to define optimalization criteria. (So, the policy need not be optimal in any sense.)
-
There is good chance that such a policy works well.
Problem is, no one know exactly how such a policy looks like. So let's discuss it.
Here a policy that works fine for me (as a home user). The basic rationale behind is to apply run-time curves whenever there is VoIP and/or game traffic, and to apply link-share curves otherwise.
A. Root queues
Set qWANroot and qLANroot to 80% up/downlink bandwidth. (Maybe 90-95% for fast [mb/s] links.)
B. Sub-queues
For each up/down link, use only seven predefined sub-queues – p2p, low, default, high, games, voip, ack, and set the following queue priorities (from lowest to highest).
Priority 1. p2p
Priority 2. low
Priority 3. def[ault]
Priority 4. high
Priority 5. game
Priority 6. voip
Priority 7. ackC. Upper-limit curves
1. Set upper-limit curves for p2p queues only.
2. Suitable upper limits of qWANp2p and qLANp2p are 80% of qWANroot and qLANroot, respectively.
D. Linkshare curves
1. The link share (i.e., m1 and m2) of qWANack should be made as large as required (by calculation, excluding VoIP and game activities).
2. The link share of qWANhigh should be made several (say, 2 - 3) times larger than that of qWANdef.
3. The link share of qWANdef should be made several (say, 4 - 6) times larger than that of qWANlow.
4. The link share of qLANlow should be the same as that of qWANp2p.
5. The link shares of qLANack, high, def, low, p2p are set similarly.
E. Realtime curves
1. If VoIP or games also use ACK queues, set qWANack's m1 as large as required (by calculation, excluding everything in qWANp2p, qWANlow, qWANdef, qWANhigh).
2. Set qWANack's m2 = m1.
3. Set qLANack's m1 and m2 similarly.
4. For qWANvoip, given a required number of concurrent calls and average voip packet size, set m1 such that an average packet shall not delay longer than specified. Set qLANvoip's m1 similarly. If the 'given' parameters are not given then, as the default, set the required number of concurrent calls to 1, the average packet size to 150 bytes and the maximum allowable delay to 10 ms (so, qWANvoip's m1 = qLANvoip's m1 = 120 kb/s per call).
5. qWANgame and qLANgame's m1 are set similarly to voip. Note however that the average packet size (and the maximal allowable packet delays) for need not be the same for incoming and outgoing direction. If the 'given' parameters are not given then, as the default, set the required number of concurent local players to 1, the average packet size to 200 bytes in both directions, and the maximum allowable delay to 50 ms in both directions (so, m1 = 32 kb/s per player for both qWANgame and qLANgame). Also note that in some cases, after allocating m1 to qWANack and qWANvoip, taking into account that the sum of real-time service curves must not exceed 80% qWANroot, few percentage of m1 remains and the best we can do is simply to allocate the rest to qWANgame, thus we can only guarantee the game delay as low as possible.
6. [Part of] the rest of m2 is allocated to qWANvoip's m2 and qWANgame's m2 in amounts required for reasonable traffic. Similarly for qLANvoip's m2 and qLANgame's m2. If not further specified, the 'reasonable traffic' means 32 kb/s per concurrent VoIP call plus 32 kb/s (in both directions) per concurrent local game player.
-
-
Thank you for helping in this, 2 minds are always better than 1.
Then the wizard/daemon should simulate the policy-making-and-adjusting process of an exprerienced user, right? That seems to be a different approach (as opposed to optimalization). It's more practical and simpler to implement.
-
We get rid of the need to define optimalization criteria. (So, the policy need not be optimal in any sense.)
-
There is good chance that such a policy works well.
Problem is, no one know exactly how such a policy looks like. So let's discuss it.
Well just an update, the new wizard uses percentages values for getting input from user. Since there can be multiple links, which the wizard now supports, it is not preferable to ask the user how much he/she wants for each separate link so to me percentages made the most sense. They allow me to apply the correct policy to all the links selected, which might be of different scheduler even.
My comments and point of discussion are below.
Here a policy that works fine for me (as a home user). The basic rationale behind is to apply run-time curves whenever there is VoIP and/or game traffic, and to apply link-share curves otherwise.
A. Root queues
Set qWANroot and qLANroot to 80% up/downlink bandwidth. (Maybe 90-95% for fast [mb/s] links.)
B. Sub-queues
For each up/down link, use only seven predefined sub-queues – p2p, low, default, high, games, voip, ack, and set the following queue priorities (from lowest to highest).
Priority 1. p2p
Priority 2. low
Priority 3. def[ault]
Priority 4. high
Priority 5. game
Priority 6. voip
Priority 7. ackThe number of queues might be less depending on what the user chooses, but the wizard will not create more than this queues if you select all options.
I select the default queue depending if the user has selected p2pcatchall or not. If he does p2p becomes the default queue otherwise default queue will keep all uncategorized traffic and default queue always has better priority than p2p and lowerPriority queue.Keep in mind we are talking about the modified wizard that is on RELENG_1 tree.
C. Upper-limit curves
1. Set upper-limit curves for p2p queues only.
2. Suitable upper limits of qWANp2p and qLANp2p are 80% of qWANroot and qLANroot, respectively.
1- Already do.
2- Do not need to since default already do that. For your information, there is no more a qWANroot/qLANroot since there is one provided by HFSC discipline by default. That's why i do not need to setup those queues and i setup upperlimit of p2p for now to 20- 30% of the link.D. Linkshare curves
1. The link share (i.e., m1 and m2) of qWANack should be made as large as required (by calculation, excluding VoIP and game activities).
2. The link share of qWANhigh should be made several (say, 2 - 3) times larger than that of qWANdef.
3. The link share of qWANdef should be made several (say, 4 - 6) times larger than that of qWANlow.
4. The link share of qLANlow should be the same as that of qWANp2p.
5. The link shares of qLANack, high, def, low, p2p are set similarly.
To me makes more sense playing with delay more than bandwidth since the overall result is the same.
Even more, for HFSC i would really question the need of an ACK queue unless i know the link latency and configure it to not get in between VoIP and Games shaping. Since VoIP is not a consumer of ACK queue and Games are questionable about that, see below.E. Realtime curves
1. If VoIP or games also use ACK queues, set qWANack's m1 as large as required (by calculation, excluding everything in qWANp2p, qWANlow, qWANdef, qWANhigh).
2. Set qWANack's m2 = m1.
3. Set qLANack's m1 and m2 similarly.
4. For qWANvoip, given a required number of concurrent calls and average voip packet size, set m1 such that an average packet shall not delay longer than specified. Set qLANvoip's m1 similarly. If the 'given' parameters are not given then, as the default, set the required number of concurrent calls to 1, the average packet size to 150 bytes and the maximum allowable delay to 10 ms (so, qWANvoip's m1 = qLANvoip's m1 = 120 kb/s per call).
5. qWANgame and qLANgame's m1 are set similarly to voip. Note however that the average packet size (and the maximal allowable packet delays) for need not be the same for incoming and outgoing direction. If the 'given' parameters are not given then, as the default, set the required number of concurent local players to 1, the average packet size to 200 bytes in both directions, and the maximum allowable delay to 50 ms in both directions (so, m1 = 32 kb/s per player for both qWANgame and qLANgame). Also note that in some cases, after allocating m1 to qWANack and qWANvoip, taking into account that the sum of real-time service curves must not exceed 80% qWANroot, few percentage of m1 remains and the best we can do is simply to allocate the rest to qWANgame, thus we can only guarantee the game delay as low as possible.
6. [Part of] the rest of m2 is allocated to qWANvoip's m2 and qWANgame's m2 in amounts required for reasonable traffic. Similarly for qLANvoip's m2 and qLANgame's m2. If not further specified, the 'reasonable traffic' means 32 kb/s per concurrent VoIP call plus 32 kb/s (in both directions) per concurrent local game player.
1- VoIP will not use ACK i have not seen any phone using TCP for this kind of traffic and i think we know that tcp gives pretty bad latency ofr such traffic.
2 and 3 - i do not see the reason for that, since i need still to be convinced that ACK queue does not get in the tracks of VoIP and Games in HFSC case.
4- Well now i set m1 = 25% of the link d = 30ms and m2 = 5%-20% depending on the user choices. That should take care of most home setups others might need to tweak it.5- In the new shaper i use percentages as input from the user which makes me unbound to the speed specified for LAN/WAN or whatever number of links you have in the box. For Games d = 50ms will be OK(i think, but i am not much of a gamer), and HFSC realtime scheduler should overcommit when needed in the bounds of 80% so i think its better to leave it to choose what to do. Even though that 80% upperlimit for realtime is constructed to allow safe overcommit when needed and giving it some more amount where to overcommit safely is better.
For ACK queue for game i don't think is needed since usual home setups only have 2 - max 4 players and the delay can be guaranteed by the real time scheduler. Taking in consideration that most setups are asymmetric the bandwidth is there already and only delay is the culprit.6- Well i think that most of the user will choose more then needed bandwidth during the wizard so that amount will be distributed accordingly. I think that delay parameter to the linkshare part of Games, OthersHigh and VoIP queue would need more discussion than the remaining bandwidth.
-
-
Well it appears that in essence, my figures agree with yours. Only few details diverge.
- The delay. As far as I know, the maximum allowable delay is specified by m1, not d. (Thus if m1 = m2, then d does not matter at all.) If we require that an average packet of S bytes shall not delay longer than D ms (assuming single voip call/game player), we do that by setting m1 to
m1 = 8 * S / D [kb/s]
(kb reads 'kilobit'.)
-
The unit of m1 and m2 of real-time curves. I prefer specifying m1 and m2 in kb/s rather than in %. That's because the link is asymmetric, the same m1 kb/s in both directions would result in significantly different % of uplink and downlink. For S=150 bytes, m1 = 120 kb/s (per concurrent voip call) guarantees D=10 ms regardless of the link, while m1= 25% of 1024 kb/s downlink would guarantee D = 4.7 ms, and m1=25% of 256 kb/s uplink would guarantee D = 18.8 ms. Although 4.7 ms and 18.8 ms may be both acceptable, they look like a choice at random rather than an exact delay specification.
-
The meaning of the d parameter. I believe that d should be directly related to D and never less than D. For a few N concurrent voip calls (or concurrent game players) and the required maximum delay D ms, the suitable d is
d = (N+2) * D [ms]
One may also set d = (N+1) * D or N*D.
Thus if N = 1 and D = 10 ms (VoIP) then d = 10-30 ms,
and if N = 1 and D = 50 ms (games) then d = 50-150 ms. -
Right, but i can have the problem that the user selects CBQ for downlink and HFSC for uplink and i could not translate the formula above to have some meaning for CBQ.(Personal thought, i could only if i patch PF to let me set the maxbust packet of CBQ :). I will think about handling different schedulers some more and let you know what i choose, in the mean time if you have a proposal apart a different wizard for different cases(which even might consider after all the discussion and your help) i will consider it.
My choices in percentages are forced from the generalization the wizard should give.
Yeah d is propperly what you understand it to be. As i said above, i would think about this better to see what conclusion i will arrive.Thanks again for your support.