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