c58d05fba9739569fbd610f780b6b730c73f620f
[csit.git] / docs / cpta / methodology / index.rst
1 .. _trending_methodology:
2
3 Trending Methodology
4 ====================
5
6 Overview
7 --------
8
9 // Below paragraph needs to be updated.
10 This document describes a high-level design of a system for continuous
11 performance measuring, trending and change detection for FD.io VPP SW
12 data plane. It builds upon the existing FD.io CSIT framework with
13 extensions to its throughput testing methodology, CSIT data analytics
14 engine (PAL – Presentation-and-Analytics-Layer) and associated Jenkins
15 jobs definitions.
16
17 // Below paragraph needs to be updated.
18 Proposed design replaces existing CSIT performance trending jobs and
19 tests with new Performance Trending (PT) CSIT module and separate
20 Performance Analysis (PA) module ingesting results from PT and
21 analysing, detecting and reporting any performance anomalies using
22 historical trending data and statistical metrics. PA does also produce
23 trending dashboard and graphs with summary and drill-down views across
24 all specified tests that can be reviewed and inspected regularly by
25 FD.io developers and users community.
26
27 Performance Tests
28 -----------------
29
30 Performance trending is relies on Maximum Receive Rate
31 (MRR) tests. MRR tests measure the packet forwarding rate under the
32 maximum load offered by traffic generator over a set trial duration,
33 regardless of packet loss. Maximum load for specified Ethernet frame
34 size is set to the bi-directional link rate.
35
36 Current parameters for performance trending MRR tests:
37
38 - **Ethernet frame sizes**: 64B (78B for IPv6 tests) for all tests, IMIX for
39   selected tests (vhost, memif); all quoted sizes include frame CRC, but
40   exclude per frame transmission overhead of 20B (preamble, inter frame
41   gap).
42 - **Maximum load offered**: 10GE and 40GE link (sub-)rates depending on NIC
43   tested, with the actual packet rate depending on frame size,
44   transmission overhead and traffic generator NIC forwarding capacity.
45
46   - For 10GE NICs the maximum packet rate load is 2* 14.88 Mpps for 64B,
47     a 10GE bi-directional link rate.
48   - For 40GE NICs the maximum packet rate load is 2* 18.75 Mpps for 64B,
49     a 40GE bi-directional link sub-rate limited by the packet forwarding
50     capacity of 2-port 40GE NIC model (XL710) used on T-Rex Traffic
51     Generator.
52
53 - **Trial duration**: 1 sec.
54 - **Number of trials per test**: 10.
55 - **Test execution frequency**: twice a day, every 12 hrs (02:00,
56   14:00 UTC).
57
58 Note: MRR tests should be reporting bi-directional link rate (or NIC
59 rate, if lower) if tested VPP configuration can handle the packet rate
60 higher than bi-directional link rate, e.g. large packet tests and/or
61 multi-core tests. In other words MRR = min(VPP rate, bi-dir link rate,
62 NIC rate).
63
64 Trend Analysis
65 --------------
66
67 All measured performance trend data is treated as time-series data that
68 can be modelled as concatenation of groups, each group modelled
69 using normal distribution. While sometimes the samples within a group
70 are far from being distributed normally, currently we do not have a
71 better tractable model.
72
73 The group boundaries are selected based on `Minimum Description Length`_.
74
75 Minimum Description Length
76 --------------------------
77
78 `Minimum Description Length`_ (MDL) is a particular formalization
79 of `Occam's razor`_ principle.
80
81 The general formulation mandates to evaluate a large set of models,
82 but for anomaly detection purposes, it is useful to consider
83 a smaller set of models, so that scoring and comparing them is easier.
84
85 For each candidate model, the data should be compressed losslessly,
86 which includes model definitions, encoded model parameters,
87 and the raw data encoded based on probabilities computed by the model.
88 The model resulting in shortest compressed message is the "the" correct model.
89
90 For our model set (groups of normally distributed samples),
91 we need to encode group length (which penalizes too many groups),
92 group average (more on that later), group stdev and then all the samples.
93
94 Luckily, the "all the samples" part turns out to be quite easy to compute.
95 If sample values are considered as coordinates in (multi-dimensional)
96 Euclidean space, fixing stdev means the point with allowed coordinates
97 lays on a sphere. Fixing average intersects the sphere with a (hyper)-plane,
98 and Gaussian probability density on the resulting sphere is constant.
99 So the only contribution is the "area" of the sphere, which only depends
100 on the number of samples and stdev.
101
102 A somehow ambiguous part is in choosing which encoding
103 is used for group size, average and stdev.
104 Diferent encodings cause different biases to large or small values.
105 In our implementation we have chosen probability density
106 corresponding to uniform distribution (from zero to maximal sample value)
107 for stdev and average of the first group,
108 but for averages of subsequent groups we have chosen a distribution
109 which disourages deliminating groups with averages close together.
110
111 // Below paragraph needs to be updated.
112 One part of our implementation which is not precise enough
113 is handling of measurement precision.
114 The minimal difference in MRR values is currently 0.1 pps
115 (the difference of one packet over 10 second trial),
116 but the code assumes the precision is 1.0.
117 Also, all the calculations assume 1.0 is totally negligible,
118 compared to stdev value.
119
120 The group selection algorithm currently has no parameters,
121 all the aforementioned encodings and handling of precision is hardcoded.
122 In principle, every group selection is examined, and the one encodable
123 with least amount of bits is selected.
124 As the bit amount for a selection is just sum of bits for every group,
125 finding the best selection takes number of comparisons
126 quadratically increasing with the size of data,
127 the overall time complexity being probably cubic.
128
129 The resulting group distribution looks good
130 if samples are distributed normally enough within a group.
131 But for obviously different distributions (for example `bimodal distribution`_)
132 the groups tend to focus on less relevant factors (such as "outlier" density).
133
134 Anomaly Detection
135 `````````````````
136
137 Once the trend data is divided into groups, each group has its population average.
138 The start of the following group is marked as a regression (or progression)
139 if the new group's average is lower (higher) then the previous group's.
140
141 Trend Compliance
142 ````````````````
143
144 Trend compliance metrics are targeted to provide an indication of trend
145 changes over a short-term (i.e. weekly) and a long-term (i.e.
146 quarterly), comparing the last group average AVG[last], to the one from week
147 ago, AVG[last - 1week] and to the maximum of trend values over last
148 quarter except last week, max(AVG[last - 3mths]..ANV[last - 1week]),
149 respectively. This results in following trend compliance calculations:
150
151 // Below table needs to be updated.
152 +-------------------------+---------------------------------+-----------+-------------------------------------------+
153 | Trend Compliance Metric | Trend Change Formula            | Value     | Reference                                 |
154 +=========================+=================================+===========+===========================================+
155 | Short-Term Change       | (Value - Reference) / Reference | AVG[last] | AVG[last - 1week]                         |
156 +-------------------------+---------------------------------+-----------+-------------------------------------------+
157 | Long-Term Change        | (Value - Reference) / Reference | AVG[last] | max(AVG[last - 3mths]..AVG[last - 1week]) |
158 +-------------------------+---------------------------------+-----------+-------------------------------------------+
159
160 Trend Presentation
161 ------------------
162
163 Performance Dashboard
164 `````````````````````
165
166 Dashboard tables list a summary of per test-case VPP MRR performance
167 trend and trend compliance metrics and detected number of anomalies.
168
169 Separate tables are generated for tested VPP worker-thread-core
170 combinations (1t1c, 2t2c, 4t4c). Test case names are linked to
171 respective trending graphs for ease of navigation thru the test data.
172
173 Trendline Graphs
174 ````````````````
175
176 Trendline graphs show per test case measured MRR throughput values with
177 associated gruop averages. The graphs are constructed as follows:
178
179 - X-axis represents performance trend job build Id (csit-vpp-perf-mrr-
180   daily-master-build).
181 - Y-axis represents MRR throughput in Mpps.
182 - Markers to indicate anomaly classification:
183
184   - Regression - red circle.
185   - Progression - green circle.
186
187 - The line shows average of each group.
188
189 In addition the graphs show dynamic labels while hovering over graph
190 data points, representing (trend job build Id, MRR value) and the actual
191 vpp build number (b<XXX>) tested.
192
193
194 Jenkins Jobs
195 ------------
196
197 Performance Trending (PT)
198 `````````````````````````
199
200 CSIT PT runs regular performance test jobs measuring and collecting MRR
201 data per test case. PT is designed as follows:
202
203 1. PT job triggers:
204
205    a) Periodic e.g. daily.
206    b) On-demand gerrit triggered.
207
208 2. Measurements and data calculations per test case:
209
210   a) Max Received Rate (MRR) - send packets at link rate over a trial
211      period, count total received packets, divide by trial period.
212
213 3. Archive MRR per test case.
214 4. Archive all counters collected at MRR.
215
216 Performance Analysis (PA)
217 `````````````````````````
218
219 CSIT PA runs performance analysis including trendline calculation, trend
220 compliance and anomaly detection using specified trend analysis metrics
221 over the rolling window of last <N> sets of historical measurement data.
222 PA is defined as follows:
223
224 1. PA job triggers:
225
226    a) By PT job at its completion.
227    b) On-demand gerrit triggered.
228
229 2. Download and parse archived historical data and the new data:
230
231    a) Download RF output.xml files from latest PT job and compressed
232       archived data.
233    b) Parse out the data filtering test cases listed in PA specification
234       (part of CSIT PAL specification file).
235
236 3. Re-calculate new groups and their averages.
237
238 4. Evaluate new test data:
239
240    a) If the existing group is prolonged => Result = Pass,
241       Reason = Normal. (to be updated base on the final Jenkins code).
242    b) If a new group is detected with lower average => Result = Fail, Reason = Regression.
243    c) If a new group is detected with higher average => Result = Pass, Reason = Progression.
244
245 5. Generate and publish results
246
247    a) Relay evaluation result to job result. (to be updated base on the
248       final Jenkins code).
249    b) Generate a new set of trend summary dashboard and graphs.
250    c) Publish trend dashboard and graphs in html format on
251       https://docs.fd.io/.
252
253 Testbed HW configuration
254 ------------------------
255
256 The testbed HW configuration is described on
257 `this FD.IO wiki page <https://wiki.fd.io/view/CSIT/CSIT_LF_testbed#FD.IO_CSIT_testbed_-_Server_HW_Configuration>`_.
258
259 .. _Minimum Description Length: https://en.wikipedia.org/wiki/Minimum_description_length
260 .. _Occam's razor: https://en.wikipedia.org/wiki/Occam%27s_razor
261 .. _bimodal distribution: https://en.wikipedia.org/wiki/Bimodal_distribution