9b03c45207ff233e443b7256ed2c215fd32cd544
[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
85 But it is not recommended to use them for test selection,
86 as it is not that easy to determine how many test cases are selected.
87
88 The recommended way is to look into CSIT repository first,
89 and locate a specific suite the user is interested in,
90 and use its suite tag. For example, "ethip4-ip4base" is a suite tag
91 selecting just one suite in CSIT git repository,
92 avoiding all scale, container, and other simialr variants.
93
94 Note that CSIT uses "autogen" code generator,
95 so the robot running in Jenkins has access to more suites
96 than visible just by looking into CSIT git repository,
97 so suite tag is not enough to select even the intended suite,
98 and user still probably wants to narrow down
99 to a single test case within a suite.
100
101 Fully specified tag expressions
102 ```````````````````````````````
103
104 Here is one template to select a single test case:
105 {test_type}AND{nic_model}AND{nic_driver}AND{cores}AND{frame_size}AND{suite_tag}
106 where the variables are all lower case (so AND operator stands out).
107
108 Currently only one test type is supported by the performance comparison jobs:
109 "mrr".
110 The nic_driver options depend on nic_model. For Intel cards "drv_avf" (AVF plugin)
111 and "drv_vfio_pci" (DPDK plugin) are popular, for Mellanox "drv_rdma_core".
112 Currently, the performance using "drv_af_xdp" is not reliable enough, so do not use it
113 unless you are specifically testing for AF_XDP.
114
115 The most popular nic_model is "nic_intel-xxv710", but that is not available
116 on all testbed types.
117 It is safe to use "1c" for cores (unless you are suspection multi-core performance
118 is affected differently) and "64b" for frame size ("78b" for ip6
119 and more for dot1q and other encapsulated traffic;
120 "1518b" is popular for ipsec and other payload-bound tests).
121
122 As there are more test cases than CSIT can periodically test,
123 it is possible to encounter an old test case that currently fails.
124 To avoid that, you can look at "job spec" files we use for periodic testing,
125 for example `this one <https://github.com/FDio/csit/blob/master/resources/job_specs/report_iterative/2n-icx/vpp-mrr-00.md>`_.
126
127
128 Shortening triggers
129 ```````````````````
130
131 Advanced users may use the following tricks to avoid writing long trigger comments.
132
133 Robot supports glob matching, which can be used to select multiple suite tags at once.
134
135 Not specifying one of 6 parts of the recommended expression pattern
136 will select all available options. For example not specifying nic_driver
137 for nic_intel-xxv710 will select all 3 applicable drivers.
138 You can use NOT operator to reject some options (e.g. NOTdrv_af_xdp),
139 but beware, with NOT the order matters:
140 tag1ANDtag2NOTtag3 is not the same as tag1NOTtag3ANDtag2,
141 the latter is evaluated as tag1AND(NOT(tag3ANDtag2)).
142
143 Beware when not specifying nic_model. As a precaution,
144 CSIT code will insert the defailt NIC model for the tetsbed used.
145 Example: Specifying drv_rdma_core without specifying nic_model
146 will fail, as the default nic_model is nic_intel-xxv710
147 which does not support RDMA core driver.
148
149 Complete example
150 ````````````````
151
152 A user wants to test a VPP change which may affect load balance whith bonding.
153 Searching tag documentation for "bonding" finds LBOND tag and its variants.
154 Searching CSIT git repository (directory tests/) finds 8 suite files,
155 all suited only for 3-node testbeds.
156 All suites are using vhost, but differ by the forwarding app inside VM
157 (DPDK or VPP), by the forwarding mode of VPP acting as host level vswitch
158 (MAC learning or cross connect), and by the number of DUT1-DUT2 links
159 available (1 or 2).
160
161 As not all NICs and testbeds offer enogh ports for 2 parallel DUT-DUT links,
162 the user looks at `testbed specifications <https://github.com/FDio/csit/tree/master/topologies/available>`_
163 and finds that only xxv710 NIC on 3n-icx testbed matches the requirements.
164 Quick look into the suites confirm the smallest frame size is 64 bytes
165 (despite DOT1Q robot tag, as the encapsulation does not happen on TG-DUT links).
166 It is ok to use just 1 physical core, as 3n-icx has hyperthreading enabled,
167 so VPP vswitch will use 2 worker threads.
168
169 The user decides the vswitch forwarding mode is not important
170 (so choses cross connect as that has less CPU overhead),
171 but wants to test both NIC drivers (not AF_XDP), both apps in VM,
172 and both 1 and 2 parallel links.
173
174 After shortening, this is the trigger comment fianlly used:
175 perftest-3n-icx mrrANDnic_intel-x710AND1cAND64bAND?lbvpplacp-dot1q-l2xcbase-eth-2vhostvr1024-1vm*NOTdrv_af_xdp
176
177 Basic operation
178 ~~~~~~~~~~~~~~~
179
180 The job builds VPP .deb packages for both the patch under test
181 (called "current") and its parent patch (called "parent").
182
183 For each test (from a set defined by tag expression),
184 both builds are subjected to several trial measurements (BMRR).
185 Measured samples are grouped to "parent" sequence,
186 followed by "current" sequence. The same Minimal Description Length
187 algorithm as in trending is used to decide whether it is one big group,
188 or two smaller gropus. If it is one group, a "normal" result
189 is declared for the test. If it is two groups, and current average
190 is less then parent average, the test is declared a regression.
191 If it is two groups and current average is larger or equal,
192 the test is declared a progression.
193
194 The whole job fails (giving -1) if some trial measurement failed,
195 or if any test was declared a regression.
196
197 Temporary specifics
198 ~~~~~~~~~~~~~~~~~~~
199
200 The Minimal Description Length analysis is performed by
201 CSIT code equivalent to jumpavg-0.1.3 library available on PyPI.
202
203 In hopes of strengthening of signal (code performance) compared to noise
204 (all other factors influencing the measured values), several workarounds
205 are applied.
206
207 In contrast to trending, trial duration is set to 10 seconds,
208 and only 5 samples are measured for each build.
209 Both parameters are set in ci-management.
210
211 This decreases sensitivity to regressions, but also decreases
212 probability of false positives.
213
214 Console output
215 ~~~~~~~~~~~~~~
216
217 The following information as visible towards the end of Jenkins console output,
218 repeated for each analyzed test.
219
220 The original 5 values are visible in order they were measured.
221 The 5 values after processing are also visible in output,
222 this time sorted by value (so people can see minimum and maximum).
223
224 The next output is difference of averages. It is the current average
225 minus the parent average, expressed as percentage of the parent average.
226
227 The next three outputs contain the jumpavg representation
228 of the two groups and a combined group.
229 Here, "bits" is the description length; for "current" sequence
230 it includes effect from "parent" average value
231 (jumpavg-0.1.3 penalizes sequences with too close averages).
232
233 Next, a sentence describing which grouping description is shorter,
234 and by how much bits.
235 Finally, the test result classification is visible.
236
237 The algorithm does not track test case names,
238 so test cases are indexed (from 0).