1 .. _mlrsearch_algorithm:
6 Multiple Loss Rate search (MLRsearch) tests use new search algorithm
7 implemented in FD.io CSIT project. MLRsearch discovers multiple packet
8 throughput rates in a single search, with each rate associated with a
9 distinct Packet Loss Ratio (PLR) criteria. MLRsearch is being
10 standardized in IETF with `draft-vpolak-mkonstan-mlrsearch-XX
11 <https://tools.ietf.org/html/draft-vpolak-mkonstan-mlrsearch-00>`_.
13 Two throughput measurements used in FD.io CSIT are Non-Drop Rate (NDR,
14 with zero packet loss, PLR=0) and Partial Drop Rate (PDR, with packet
15 loss rate not greater than the configured non-zero PLR). MLRsearch
16 discovers NDR and PDR in a single pass reducing required execution time
17 compared to separate binary searches for NDR and PDR. MLRsearch reduces
18 execution time even further by relying on shorter trial durations
19 of intermediate steps, with only the final measurements
20 conducted at the specified final trial duration.
21 This results in the shorter overall search
22 execution time when compared to a standard NDR/PDR binary search,
23 while guaranteeing the same or similar results.
25 If needed, MLRsearch can be easily adopted to discover more throughput rates
26 with different pre-defined PLRs.
28 .. Note:: All throughput rates are *always* bi-directional
29 aggregates of two equal (symmetric) uni-directional packet rates
30 received and reported by an external traffic generator.
35 The main properties of MLRsearch:
37 - MLRsearch is a duration aware multi-phase multi-rate search algorithm.
39 - Initial phase determines promising starting interval for the search.
40 - Intermediate phases progress towards defined final search criteria.
41 - Final phase executes measurements according to the final search
46 - Uses link rate as a starting transmit rate and discovers the Maximum
47 Receive Rate (MRR) used as an input to the first intermediate phase.
49 - *Intermediate phases*:
51 - Start with initial trial duration (in the first phase) and converge
52 geometrically towards the final trial duration (in the final phase).
53 - Track two values for NDR and two for PDR.
55 - The values are called (NDR or PDR) lower_bound and upper_bound.
56 - Each value comes from a specific trial measurement
57 (most recent for that transmit rate),
58 and as such the value is associated with that measurement's duration and
60 - A bound can be invalid, for example if NDR lower_bound
61 has been measured with nonzero loss.
62 - Invalid bounds are not real boundaries for the searched value,
63 but are needed to track interval widths.
64 - Valid bounds are real boundaries for the searched value.
65 - Each non-initial phase ends with all bounds valid.
67 - Start with a large (lower_bound, upper_bound) interval width and
68 geometrically converge towards the width goal (measurement resolution)
69 of the phase. Each phase halves the previous width goal.
70 - Use internal and external searches:
72 - External search - measures at transmit rates outside the (lower_bound,
73 upper_bound) interval. Activated when a bound is invalid,
74 to search for a new valid bound by doubling the interval width.
75 It is a variant of `exponential search`_.
76 - Internal search - `binary search`_, measures at transmit rates within the
77 (lower_bound, upper_bound) valid interval, halving the interval width.
79 - *Final phase* is executed with the final test trial duration, and the final
80 width goal that determines resolution of the overall search.
81 Intermediate phases together with the final phase are called non-initial
84 The main benefits of MLRsearch vs. binary search include:
86 - In general MLRsearch is likely to execute more search trials overall, but
87 less trials at a set final duration.
88 - In well behaving cases it greatly reduces (>50%) the overall duration
89 compared to a single PDR (or NDR) binary search duration,
90 while finding multiple drop rates.
91 - In all cases MLRsearch yields the same or similar results to binary search.
92 - Note: both binary search and MLRsearch are susceptible to reporting
93 non-repeatable results across multiple runs for very bad behaving
98 - Worst case MLRsearch can take longer than a binary search e.g. in case of
99 drastic changes in behaviour for trials at varying durations.
101 Search Implementation
102 ~~~~~~~~~~~~~~~~~~~~~
104 Following is a brief description of the current MLRsearch
105 implementation in FD.io CSIT.
110 #. *maximum_transmit_rate* - maximum packet transmit rate to be used by
111 external traffic generator, limited by either the actual Ethernet
112 link rate or traffic generator NIC model capabilities. Sample
113 defaults: 2 * 14.88 Mpps for 64B 10GE link rate,
114 2 * 18.75 Mpps for 64B 40GE NIC maximum rate.
115 #. *minimum_transmit_rate* - minimum packet transmit rate to be used for
116 measurements. MLRsearch fails if lower transmit rate needs to be
117 used to meet search criteria. Default: 2 * 10 kpps (could be higher).
118 #. *final_trial_duration* - required trial duration for final rate
119 measurements. Default: 30 sec.
120 #. *initial_trial_duration* - trial duration for initial MLRsearch phase.
122 #. *final_relative_width* - required measurement resolution expressed as
123 (lower_bound, upper_bound) interval width relative to upper_bound.
125 #. *packet_loss_ratio* - maximum acceptable PLR search criteria for
126 PDR measurements. Default: 0.5%.
127 #. *number_of_intermediate_phases* - number of phases between the initial
128 phase and the final phase. Impacts the overall MLRsearch duration.
129 Less phases are required for well behaving cases, more phases
130 may be needed to reduce the overall search duration for worse behaving
132 Default (2). (Value chosen based on limited experimentation to date.
133 More experimentation needed to arrive to clearer guidelines.)
138 1. First trial measures at maximum rate and discovers MRR.
140 a. *in*: trial_duration = initial_trial_duration.
141 b. *in*: offered_transmit_rate = maximum_transmit_rate.
142 c. *do*: single trial.
143 d. *out*: measured loss ratio.
144 e. *out*: mrr = measured receive rate.
146 2. Second trial measures at MRR and discovers MRR2.
148 a. *in*: trial_duration = initial_trial_duration.
149 b. *in*: offered_transmit_rate = MRR.
150 c. *do*: single trial.
151 d. *out*: measured loss ratio.
152 e. *out*: mrr2 = measured receive rate.
154 3. Third trial measures at MRR2.
156 a. *in*: trial_duration = initial_trial_duration.
157 b. *in*: offered_transmit_rate = MRR2.
158 c. *do*: single trial.
159 d. *out*: measured loss ratio.
166 a. *in*: trial_duration for the current phase.
167 Set to initial_trial_duration for the first intermediate phase;
168 to final_trial_duration for the final phase;
169 or to the element of interpolating geometric sequence
170 for other intermediate phases.
171 For example with two intermediate phases, trial_duration
172 of the second intermediate phase is the geometric average
173 of initial_strial_duration and final_trial_duration.
174 b. *in*: relative_width_goal for the current phase.
175 Set to final_relative_width for the final phase;
176 doubled for each preceding phase.
177 For example with two intermediate phases,
178 the first intermediate phase uses quadruple of final_relative_width
179 and the second intermediate phase uses double of final_relative_width.
180 c. *in*: ndr_interval, pdr_interval from the previous main loop iteration
181 or the previous phase.
182 If the previous phase is the initial phase, both intervals have
183 lower_bound = MRR2, uper_bound = MRR.
184 Note that the initial phase is likely to create intervals with invalid
186 d. *do*: According to the procedure described in point 2,
187 either exit the phase (by jumping to 1.g.),
188 or prepare new transmit rate to measure with.
189 e. *do*: Perform the trial measurement at the new transmit rate
190 and trial_duration, compute its loss ratio.
191 f. *do*: Update the bounds of both intervals, based on the new measurement.
192 The actual update rules are numerous, as NDR external search
193 can affect PDR interval and vice versa, but the result
194 agrees with rules of both internal and external search.
195 For example, any new measurement below an invalid lower_bound
196 becomes the new lower_bound, while the old measurement
197 (previously acting as the invalid lower_bound)
198 becomes a new and valid upper_bound.
199 Go to next iteration (1.c.), taking the updated intervals as new input.
200 g. *out*: current ndr_interval and pdr_interval.
201 In the final phase this is also considered
202 to be the result of the whole search.
203 For other phases, the next phase loop is started
204 with the current results as an input.
206 2. New transmit rate (or exit) calculation (for 1.d.):
208 - If there is an invalid bound then prepare for external search:
210 - *If* the most recent measurement at NDR lower_bound transmit rate
211 had the loss higher than zero, then
212 the new transmit rate is NDR lower_bound
213 decreased by two NDR interval widths.
214 - Else, *if* the most recent measurement at PDR lower_bound
215 transmit rate had the loss higher than PLR, then
216 the new transmit rate is PDR lower_bound
217 decreased by two PDR interval widths.
218 - Else, *if* the most recent measurement at NDR upper_bound
219 transmit rate had no loss, then
220 the new transmit rate is NDR upper_bound
221 increased by two NDR interval widths.
222 - Else, *if* the most recent measurement at PDR upper_bound
223 transmit rate had the loss lower or equal to PLR, then
224 the new transmit rate is PDR upper_bound
225 increased by two PDR interval widths.
226 - If interval width is higher than the current phase goal:
228 - Else, *if* NDR interval does not meet the current phase width goal,
229 prepare for internal search. The new transmit rate is
230 (NDR lower bound + NDR upper bound) / 2.
231 - Else, *if* PDR interval does not meet the current phase width goal,
232 prepare for internal search. The new transmit rate is
233 (PDR lower bound + PDR upper bound) / 2.
234 - Else, *if* some bound has still only been measured at a lower duration,
235 prepare to re-measure at the current duration (and the same transmit
236 rate). The order of priorities is:
242 - *Else*, do not prepare any new rate, to exit the phase.
243 This ensures that at the end of each non-initial phase
244 all intervals are valid, narrow enough, and measured
245 at current phase trial duration.
247 Implementation Deviations
248 ~~~~~~~~~~~~~~~~~~~~~~~~~
250 This document so far has been describing a simplified version of MLRsearch
251 algorithm. The full algorithm as implemented contains additional logic,
252 which makes some of the details (but not general ideas) above incorrect.
253 Here is a short description of the additional logic as a list of principles,
254 explaining their main differences from (or additions to) the simplified
255 description,but without detailing their mutual interaction.
257 1. *Logarithmic transmit rate.*
258 In order to better fit the relative width goal,
259 the interval doubling and halving is done differently.
260 For example, the middle of 2 and 8 is 4, not 5.
261 2. *Optimistic maximum rate.*
262 The increased rate is never higher than the maximum rate.
263 Upper bound at that rate is always considered valid.
264 3. *Pessimistic minimum rate.*
265 The decreased rate is never lower than the minimum rate.
266 If a lower bound at that rate is invalid,
267 a phase stops refining the interval further (until it gets re-measured).
268 4. *Conservative interval updates.*
269 Measurements above current upper bound never update a valid upper bound,
270 even if drop ratio is low.
271 Measurements below current lower bound always update any lower bound
272 if drop ratio is high.
273 5. *Ensure sufficient interval width.*
274 Narrow intervals make external search take more time to find a valid bound.
275 If the new transmit increased or decreased rate would result in width
276 less than the current goal, increase/decrease more.
277 This can happen if the measurement for the other interval
278 makes the current interval too narrow.
279 Similarly, take care the measurements in the initial phase
280 create wide enough interval.
281 6. *Timeout for bad cases.*
282 The worst case for MLRsearch is when each phase converges to intervals
283 way different than the results of the previous phase.
284 Rather than suffer total search time several times larger
285 than pure binary search, the implemented tests fail themselves
286 when the search takes too long (given by argument *timeout*).
288 .. _binary search: https://en.wikipedia.org/wiki/Binary_search
289 .. _exponential search: https://en.wikipedia.org/wiki/Exponential_search
290 .. _estimation of standard deviation: https://en.wikipedia.org/wiki/Unbiased_estimation_of_standard_deviation
291 .. _simplified error propagation formula: https://en.wikipedia.org/wiki/Propagation_of_uncertainty#Simplification