feat(docs): Move job_specs to resources
[csit.git] / docs / report / introduction / methodology_rca / methodology_perpatch_performance_tests.rst
1 Per-patch performance tests
2 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
3
4 Updated for CSIT git commit id: 72b45cfe662107c8e1bb549df71ba51352a898ee.
5
6 A methodology similar to trending analysis is used for comparing performance
7 before a DUT code change is merged. This can act as a verify job to disallow
8 changes which would decrease performance without a good reason.
9
10 Existing jobs
11 ~~~~~~~~~~~~~
12
13 VPP is the only project currently using such jobs.
14 They are not started automatically, must be triggered on demand.
15 They allow full tag expressions, but some tags are enforced (such as MRR).
16
17 There are jobs available for multiple types of testbeds,
18 based on various processors.
19 Their Gerrit triggers words are of the form "perftest-{node_arch}"
20 where the node_arch combinations currently supported are:
21 2n-clx, 2n-tx2, 2n-zn2, 3n-tsh.
22
23 Test selection
24 ~~~~~~~~~~~~~~
25
26 ..
27     TODO: Majority of this section is also useful for CSIT verify jobs. Move it somewhere.
28
29 Gerrit trigger line without any additional arguments selects
30 a small set of test cases to run.
31 If additional arguments are added to the Gerrit trigger, they are treated
32 as Robot tag expressions to select tests to run.
33 While very flexible, this method of test selection also allows the user
34 to accidentally select too high number of tests, blocking the testbed for days.
35
36 What follows is a list of explanations and recommendations
37 to help users to select the minimal set of tests cases.
38
39 Verify cycles
40 `````````````
41
42 When Gerrit schedules multiple jobs to run for the same patch set,
43 it waits until all runs are complete.
44 While it is waiting, it is possible to trigger more jobs
45 (adding runs to the set Gerrit is waiting for), but it is not possible
46 to trigger more runs for the same job, until Gerrit is done waiting.
47 After Gerrit is done waiting, it becames possible to trigger
48 the same job again.
49
50 Example. User triggers one set of tests on 2n-icx and immediately
51 also triggers other set of tests on 3n-icx. Then the user notices
52 2n-icx run end early because of a typo in tag expression.
53 When the user tries to re-trigger 2n-icx (with fixed tag expression),
54 that comment gets ignored by Jenkins.
55 Only when 3n-icx job finishes, the user can trigger 2n-icx.
56
57 One comment many jobs
58 `````````````````````
59
60 In the past, the CSIT code which parses for perftest trigger comments
61 was buggy, which lead to bad behavior (as in selection all performance test,
62 because "perftest" is also a robot tag) when user included multiple
63 perftest trigger words in the same comment.
64
65 The worst bugs were fixed since then, but it is still recommended
66 to use just one trigger word per Gerrit comment, just to be safe.
67
68 Multiple test cases in run
69 ``````````````````````````
70
71 While Robot supports OR operator, it does not support parentheses,
72 so the OR operator is not very useful. It is recommended
73 to use space instead of OR operator.
74
75 Example template:
76 perftest-2n-icx {tag_expression_1} {tag_expression_2}
77
78 See below for more concrete examples.
79
80 Suite tags
81 ``````````
82
83 Traditionally, CSIT maintains broad Robot tags that can be used to select tests,
84 for details on existing tags, see
85 `CSIT Tags <https://github.com/FDio/csit/blob/master/docs/tag_documentation.rst>`_.
86
87 But it is not recommended to use them for test selection,
88 as it is not that easy to determine how many test cases are selected.
89
90 The recommended way is to look into CSIT repository first,
91 and locate a specific suite the user is interested in,
92 and use its suite tag. For example, "ethip4-ip4base" is a suite tag
93 selecting just one suite in CSIT git repository,
94 avoiding all scale, container, and other simialr variants.
95
96 Note that CSIT uses "autogen" code generator,
97 so the robot running in Jenkins has access to more suites
98 than visible just by looking into CSIT git repository,
99 so suite tag is not enough to select even the intended suite,
100 and user still probably wants to narrow down
101 to a single test case within a suite.
102
103 Fully specified tag expressions
104 ```````````````````````````````
105
106 Here is one template to select a single test case:
107 {test_type}AND{nic_model}AND{nic_driver}AND{cores}AND{frame_size}AND{suite_tag}
108 where the variables are all lower case (so AND operator stands out).
109
110 Currently only one test type is supported by the performance comparison jobs:
111 "mrr".
112 The nic_driver options depend on nic_model. For Intel cards "drv_avf" (AVF plugin)
113 and "drv_vfio_pci" (DPDK plugin) are popular, for Mellanox "drv_rdma_core".
114 Currently, the performance using "drv_af_xdp" is not reliable enough, so do not use it
115 unless you are specifically testing for AF_XDP.
116
117 The most popular nic_model is "nic_intel-xxv710", but that is not available
118 on all testbed types.
119 It is safe to use "1c" for cores (unless you are suspection multi-core performance
120 is affected differently) and "64b" for frame size ("78b" for ip6
121 and more for dot1q and other encapsulated traffic;
122 "1518b" is popular for ipsec and other payload-bound tests).
123
124 As there are more test cases than CSIT can periodically test,
125 it is possible to encounter an old test case that currently fails.
126 To avoid that, you can look at "job spec" files we use for periodic testing,
127 for example `this one <https://github.com/FDio/csit/blob/master/resources/job_specs/report_iterative/2n-icx/vpp-mrr-00.md>`_.
128
129
130 Shortening triggers
131 ```````````````````
132
133 Advanced users may use the following tricks to avoid writing long trigger comments.
134
135 Robot supports glob matching, which can be used to select multiple suite tags at once.
136
137 Not specifying one of 6 parts of the recommended expression pattern
138 will select all available options. For example not specifying nic_driver
139 for nic_intel-xxv710 will select all 3 applicable drivers.
140 You can use NOT operator to reject some options (e.g. NOTdrv_af_xdp),
141 but beware, with NOT the order matters:
142 tag1ANDtag2NOTtag3 is not the same as tag1NOTtag3ANDtag2,
143 the latter is evaluated as tag1AND(NOT(tag3ANDtag2)).
144
145 Beware when not specifying nic_model. As a precaution,
146 CSIT code will insert the defailt NIC model for the tetsbed used.
147 Example: Specifying drv_rdma_core without specifying nic_model
148 will fail, as the default nic_model is nic_intel-xxv710
149 which does not support RDMA core driver.
150
151 Complete example
152 ````````````````
153
154 A user wants to test a VPP change which may affect load balance whith bonding.
155 Searching tag documentation for "bonding" finds LBOND tag and its variants.
156 Searching CSIT git repository (directory tests/) finds 8 suite files,
157 all suited only for 3-node testbeds.
158 All suites are using vhost, but differ by the forwarding app inside VM
159 (DPDK or VPP), by the forwarding mode of VPP acting as host level vswitch
160 (MAC learning or cross connect), and by the number of DUT1-DUT2 links
161 available (1 or 2).
162
163 As not all NICs and testbeds offer enogh ports for 2 parallel DUT-DUT links,
164 the user looks at `testbed specifications <https://github.com/FDio/csit/tree/master/topologies/available>`_
165 and finds that only xxv710 NIC on 3n-icx testbed matches the requirements.
166 Quick look into the suites confirm the smallest frame size is 64 bytes
167 (despite DOT1Q robot tag, as the encapsulation does not happen on TG-DUT links).
168 It is ok to use just 1 physical core, as 3n-icx has hyperthreading enabled,
169 so VPP vswitch will use 2 worker threads.
170
171 The user decides the vswitch forwarding mode is not important
172 (so choses cross connect as that has less CPU overhead),
173 but wants to test both NIC drivers (not AF_XDP), both apps in VM,
174 and both 1 and 2 parallel links.
175
176 After shortening, this is the trigger comment fianlly used:
177 perftest-3n-icx mrrANDnic_intel-x710AND1cAND64bAND?lbvpplacp-dot1q-l2xcbase-eth-2vhostvr1024-1vm*NOTdrv_af_xdp
178
179 Basic operation
180 ~~~~~~~~~~~~~~~
181
182 The job builds VPP .deb packages for both the patch under test
183 (called "current") and its parent patch (called "parent").
184
185 For each test (from a set defined by tag expression),
186 both builds are subjected to several trial measurements (BMRR).
187 Measured samples are grouped to "parent" sequence,
188 followed by "current" sequence. The same Minimal Description Length
189 algorithm as in trending is used to decide whether it is one big group,
190 or two smaller gropus. If it is one group, a "normal" result
191 is declared for the test. If it is two groups, and current average
192 is less then parent average, the test is declared a regression.
193 If it is two groups and current average is larger or equal,
194 the test is declared a progression.
195
196 The whole job fails (giving -1) if some trial measurement failed,
197 or if any test was declared a regression.
198
199 Temporary specifics
200 ~~~~~~~~~~~~~~~~~~~
201
202 The Minimal Description Length analysis is performed by
203 CSIT code equivalent to jumpavg-0.1.3 library available on PyPI.
204
205 In hopes of strengthening of signal (code performance) compared to noise
206 (all other factors influencing the measured values), several workarounds
207 are applied.
208
209 In contrast to trending, trial duration is set to 10 seconds,
210 and only 5 samples are measured for each build.
211 Both parameters are set in ci-management.
212
213 This decreases sensitivity to regressions, but also decreases
214 probability of false positives.
215
216 Console output
217 ~~~~~~~~~~~~~~
218
219 The following information as visible towards the end of Jenkins console output,
220 repeated for each analyzed test.
221
222 The original 5 values are visible in order they were measured.
223 The 5 values after processing are also visible in output,
224 this time sorted by value (so people can see minimum and maximum).
225
226 The next output is difference of averages. It is the current average
227 minus the parent average, expressed as percentage of the parent average.
228
229 The next three outputs contain the jumpavg representation
230 of the two groups and a combined group.
231 Here, "bits" is the description length; for "current" sequence
232 it includes effect from "parent" average value
233 (jumpavg-0.1.3 penalizes sequences with too close averages).
234
235 Next, a sentence describing which grouping description is shorter,
236 and by how much bits.
237 Finally, the test result classification is visible.
238
239 The algorithm does not track test case names,
240 so test cases are indexed (from 0).