Trending docs: format and section naming fixes.
[csit.git] / docs / cpta / methodology / index.rst
1 .. _trending_methodology:
2
3 Trending Methodology
4 ====================
5
6 Overview
7 --------
8
9 This document describes a high-level design of a system for continuous
10 performance measuring, trending and change detection for FD.io VPP SW
11 data plane. It builds upon the existing FD.io CSIT framework with
12 extensions to its throughput testing methodology, CSIT data analytics
13 engine (PAL – Presentation-and-Analytics-Layer) and associated Jenkins
14 jobs definitions.
15
16 Proposed design replaces existing CSIT performance trending jobs and
17 tests with new Performance Trending (PT) CSIT module and separate
18 Performance Analysis (PA) module ingesting results from PT and
19 analysing, detecting and reporting any performance anomalies using
20 historical trending data and statistical metrics. PA does also produce
21 trending dashboard and graphs with summary and drill-down views across
22 all specified tests that can be reviewed and inspected regularly by
23 FD.io developers and users community.
24
25 Performance Tests
26 -----------------
27
28 Performance trending is currently relying on the Maximum Receive Rate
29 (MRR) tests. MRR tests measure the packet forwarding rate under the
30 maximum load offered by traffic generator over a set trial duration,
31 regardless of packet loss. Maximum load for specified Ethernet frame
32 size is set to the bi-directional link rate.
33
34 Current parameters for performance trending MRR tests:
35
36 - Ethernet frame sizes: 64B (78B for IPv6 tests) for all tests, IMIX for
37   selected tests (vhost, memif); all quoted sizes include frame CRC, but
38   exclude per frame transmission overhead of 20B (preamble, inter frame
39   gap).
40
41 - Maximum load offered: 10GE and 40GE link (sub-)rates depending on NIC
42   tested, with the actual packet rate depending on frame size,
43   transmission overhead and traffic generator NIC forwarding capacity.
44
45   - For 10GE NICs the maximum packet rate load is 2* 14.88 Mpps for 64B,
46     a 10GE bi-directional link rate.
47   - For 40GE NICs the maximum packet rate load is 2* 18.75 Mpps for 64B,
48     a 40GE bi-directional link sub-rate limited by TG 40GE NIC used,
49     XL710.
50
51 - Trial duration: 10sec.
52 - Execution frequency: twice a day, every 12 hrs (02:00, 14:00 UTC).
53
54 Note: MRR tests should be reporting bi-directional link rate (or NIC
55 rate, if lower) if tested VPP configuration can handle the packet rate
56 higher than bi-directional link rate, e.g. large packet tests and/or
57 multi-core tests. In other words MRR = min(VPP rate, bi-dir link rate,
58 NIC rate).
59
60 Trend Analysis
61 --------------
62
63 All measured performance trend data is treated as time-series data that
64 can be modelled using normal distribution. After trimming the outliers,
65 the median and deviations from median are used for detecting performance
66 change anomalies following the three-sigma rule of thumb (a.k.a.
67 68-95-99.7 rule).
68
69 Metrics
70 ````````````````
71
72 Following statistical metrics are used as performance trend indicators
73 over the rolling window of last <N> sets of historical measurement data:
74
75 - Q1, Q2, Q3 : Quartiles, three points dividing a ranked data set
76   of <N> values into four equal parts, Q2 is the median of the data.
77 - IQR = Q3 - Q1 : Inter Quartile Range, measure of variability, used
78   here to calculate and eliminate outliers.
79 - Outliers : extreme values that are at least (1.5 * IQR) below Q1.
80
81   - Note: extreme values that are at least (1.5 * IQR) above Q3 are not
82     considered outliers, and are likely to be classified as
83     progressions.
84
85 - TMA : Trimmed Moving Average, average across the data set of <N>
86   values without the outliers. Used here to calculate TMSD.
87 - TMSD : Trimmed Moving Standard Deviation, standard deviation over the
88   data set of <N> values without the outliers,
89   requires calculating TMA. Used for anomaly detection.
90 - TMM : Trimmed Moving Median, median across the data set of <N> values
91   excluding the outliers. Used as a trending value and as a reference
92   for anomaly detection.
93
94 Outlier Detection
95 `````````````````
96
97 Outlier evaluation of test result of value <X> follows the definition
98 from previous section:
99
100   ::
101
102   Outlier Evaluation Formula      Evaluation Result
103   ====================================================
104   X < (Q1 - 1.5 * IQR)            Outlier
105   X >= (Q1 - 1.5 * IQR)           Valid (For Trending)
106
107 Anomaly Detection
108 `````````````````
109
110 To verify compliance of test result of valid value <X> against defined
111 trend metrics and detect anomalies, three simple evaluation formulas are
112 used:
113
114   ::
115
116         Anomaly                                   Compliance        Evaluation
117   Evaluation Formula                            Confidence Level      Result
118   =============================================================================
119   (TMM - 3 * TMSD) <= X <= (TMM + 3 * TMSD)         99.73%            Normal
120   X < (TMM - 3 * TMSD)                              Anomaly         Regression
121   X > (TMM + 3 * TMSD)                              Anomaly         Progression
122
123 TMM is used for the central trend reference point instead of TMA as it
124 is more robust to anomalies.
125
126 Trend Compliance
127 ````````````````
128
129 Trend compliance metrics are targeted to provide an indication of trend
130 changes over a short-term (i.e. weekly) and a long-term (i.e.
131 quarterly), comparing the last trend value, TMM[last], to one from week
132 ago, TMM[last - 1week] and to the maximum of trend values over last
133 quarter except last week, max(TMM[(last - 3mths)..(last - 1week)]),
134 respectively. This results in following trend compliance calculations:
135
136   ::
137
138        Trend
139   Compliance Metric     Change Formula    V(alue)      R(eference)
140   =============================================================================================
141   Short-Term Change     ((V - R) / R)     TMM[last]    TMM[last - 1week]
142   Long-Term Change      ((V - R) / R)     TMM[last]    max(TMM[(last - 3mths)..(last - 1week)])
143
144 Trend Presentation
145 ------------------
146
147 Performance Dashboard
148 `````````````````````
149
150 Dashboard tables list a summary of per test-case VPP MRR performance
151 trend and trend compliance metrics and detected number of anomalies.
152
153 Separate tables are generated for tested VPP worker-thread-core
154 combinations (1t1c, 2t2c, 4t4c). Test case names are linked to
155 respective trending graphs for ease of navigation thru the test data.
156
157 Trendline Graphs
158 ````````````````
159
160 Trendline graphs show per test case measured MRR throughput values with
161 associated trendlines. The graphs are constructed as follows:
162
163 - X-axis represents performance trend job build Id (csit-vpp-perf-mrr-
164   daily-master-build).
165 - Y-axis represents MRR throughput in Mpps.
166 - Markers to indicate anomaly classification:
167
168   - Outlier - gray circle around MRR value point.
169   - Regression - red circle.
170   - Progression - green circle.
171
172 In addition the graphs show dynamic labels while hovering over graph
173 data points, representing (trend job build Id, MRR value) and the actual
174 vpp build number (b<XXX>) tested.
175
176
177 Jenkins Jobs
178 ------------
179
180 Performance Trending (PT)
181 `````````````````````````
182
183 CSIT PT runs regular performance test jobs measuring and collecting MRR
184 data per test case. PT is designed as follows:
185
186 #. PT job triggers:
187
188   - Periodic e.g. daily.
189   - On-demand gerrit triggered.
190
191 #. Measurements and data calculations per test case:
192
193   - MRR Max Received Rate
194
195     - Measured: Unlimited tolerance of packet loss.
196     - Send packets at link rate, count total received packets, divide
197        by test trial period.
198
199 #. Archive MRR per test case.
200 #. Archive all counters collected at MRR.
201
202 Performance Analysis (PA)
203 `````````````````````````
204
205 CSIT PA runs performance analysis including trendline calculation, trend
206 compliance and anomaly detection using specified trend analysis metrics
207 over the rolling window of last <N> sets of historical measurement data.
208 PA is defined as follows:
209
210 #. PA job triggers:
211
212   - By PT job at its completion.
213   - On-demand gerrit triggered.
214
215 #. Download and parse archived historical data and the new data:
216
217   - Download RF output.xml files from latest PT job and compressed
218      archived data.
219
220   - Parse out the data filtering test cases listed in PA specification
221      (part of CSIT PAL specification file).
222
223   - Evalute new data from latest PT job against the rolling window of
224      <N> sets of historical data for trendline calculation, anomaly
225      detection and short-term trend compliance. And against long-term
226      trendline metrics for long-term trend compliance.
227
228 #. Calculate trend metrics for the rolling window of <N> sets of
229    historical data:
230
231   - Calculate quartiles Q1, Q2, Q3.
232   - Trim outliers using IQR.
233   - Calculate TMA and TMSD.
234   - Calculate normal trending range per test case based on TMM and
235      TMSD.
236
237 #. Evaluate new test data against trend metrics:
238
239   - If within the range of (TMA +/- 3*TMSD) => Result = Pass,
240      Reason = Normal. (to be updated base on the final Jenkins code).
241   - If below the range => Result = Fail, Reason = Regression.
242   - If above the range => Result = Pass, Reason = Progression.
243
244 #. Generate and publish results
245
246   - Relay evaluation result to job result. (to be updated base on the
247      final Jenkins code).
248   - Generate a new set of trend summary dashboard and graphs.
249   - Publish trend dashboard and graphs in html format on
250      https://docs.fd.io/.