835494318666a8e34a27c2dbd966575f22bccbaf
[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           Anomaly                                   Compliance        Evaluation
96     Evaluation Formula                            Confidence Level      Result
97     =============================================================================
98     (TMM - 3 * TMSD) <= X <= (TMM + 3 * TMSD)         99.73%            Normal
99     X < (TMM - 3 * TMSD)                              Anomaly         Regression
100     X > (TMM + 3 * TMSD)                              Anomaly         Progression
101
102 TMM is used for the central trend reference point instead of TMA as it
103 is more robust to anomalies.
104
105 Trend Compliance
106 ````````````````
107
108 Trend compliance metrics are targeted to provide an indication of trend
109 changes over a short-term (i.e. weekly) and a long-term (i.e.
110 quarterly), comparing the last trend value, TMM[last], to one from week
111 ago, TMM[last - 1week] and to the maximum of trend values over last
112 quarter except last week, max(TMM[(last - 3mths)..(last - 1week)]),
113 respectively. This results in following trend compliance calculations:
114
115 ::
116
117     Trend
118     Compliance Metric     Change Formula    V(alue)      R(eference)
119     =============================================================================================
120     Short-Term Change     ((V - R) / R)     TMM[last]    TMM[last - 1week]
121     Long-Term Change      ((V - R) / R)     TMM[last]    max(TMM[(last - 3mths)..(last - 1week)])
122
123 Trend Presentation
124 ------------------
125
126 Trend Dashboard
127 ```````````````
128
129 Dashboard tables list a summary of per test-case VPP MRR performance
130 trend and trend compliance metrics and detected number of anomalies.
131
132 Separate tables are generated for tested VPP worker-thread-core
133 combinations (1t1c, 2t2c, 4t4c). Test case names are linked to
134 respective trending graphs for ease of navigation thru the test data.
135
136 Trend Graphs
137 ``````````````
138
139 Trends graphs show per test case measured MRR throughput values with
140 associated trendlines. The graphs are constructed as follows:
141
142     - X-axis represents performance trend job build Id (csit-vpp-perf-mrr-
143       daily-master-build).
144     - Y-axis represents MRR throughput in Mpps.
145     - Markers to indicate anomaly classification:
146
147         - Outlier - gray circle around MRR value point.
148         - Regression - red circle.
149         - Progression - green circle.
150
151 In addition the graphs show dynamic labels while hovering over graph
152 data points, representing (trend job build Id, MRR value) and the actual
153 vpp build number (b<XXX>) tested.
154
155
156 Jenkins Jobs Description
157 ------------------------
158
159 Performance Trending (PT)
160 `````````````````````````
161
162 CSIT PT runs regular performance test jobs finding MRR per test case. PT
163 is designed as follows:
164
165     #. PT job triggers:
166
167         #. Periodic e.g. daily.
168         #. On-demand gerrit triggered.
169
170     #. Measurements and calculations per test case:
171
172         #. MRR Max Received Rate
173
174             #. Measured: Unlimited tolerance of packet loss.
175             #. Send packets at link rate, count total received packets, divide
176                by test trial period.
177
178     #. Archive MRR per test case.
179     #. Archive all counters collected at MRR.
180
181 Performance Analysis (PA)
182 `````````````````````````
183
184 CSIT PA runs performance analysis including trending and anomaly
185 detection using specified trend analysis metrics over the rolling window
186 of last <N> sets of historical measurement data. PA is defined as
187 follows:
188
189     #. PA job triggers:
190
191         #. By PT job at its completion.
192         #. On-demand gerrit triggered.
193
194     #. Download and parse archived historical data and the new data:
195
196         #. Evalute new data from latest PT job against the rolling window of
197            <N> sets of historical data.
198         #. Download RF output.xml files and compressed archived data.
199         #. Parse out the data filtering test cases listed in PA specification
200            (part of CSIT PAL specification file).
201
202     #. Calculate trend metrics for the rolling window of <N> sets of
203        historical data:
204
205         #. Calculate quartiles Q1, Q2, Q3.
206         #. Trim outliers using IQR.
207         #. Calculate TMA and TMSD.
208         #. Calculate normal trending range per test case based on TMM and TMSD.
209
210     #. Evaluate new test data against trend metrics:
211
212         #. If within the range of (TMA +/- 3*TMSD) => Result = Pass, 
213            Reason = Normal.
214         #. If below the range => Result = Fail, Reason = Regression.
215         #. If above the range => Result = Pass, Reason = Progression.
216
217     #. Generate and publish results
218
219         #. Relay evaluation result to job result.
220         #. Generate a new set of trend summary dashboard and graphs.
221         #. Publish trend dashboard and graphs in html format on https://docs.fd.io/.