feat(docs): Add Methodology
[csit.git] / docs / content / methodology / dut_state_considerations.md
1 ---
2 bookToc: false
3 title: "DUT state considerations"
4 weight: 6
5 ---
6
7 # DUT state considerations
8
9 This page discusses considerations for Device Under Test (DUT) state.
10 DUTs such as VPP require configuration, to be provided before the aplication
11 starts (via config files) or just after it starts (via API or CLI access).
12
13 During operation DUTs gather various telemetry data, depending on configuration.
14 This internal state handling is part of normal operation,
15 so any performance impact is included in the test results.
16 Accessing telemetry data is additional load on DUT,
17 so we are not doing that in main trial measurements that affect results,
18 but we include separate trials specifically for gathering runtime telemetry.
19
20 But there is one kind of state that needs specific handling.
21 This kind of DUT state is dynamically created based on incoming traffic,
22 it affects how DUT handles the traffic, and (unlike telemetry counters)
23 it has uneven impact on CPU load.
24 Typical example is NAT, where detecting new sessions takes more CPU than
25 forwarding packet on existing (open or recently closed) sessions.
26 We call DUT configurations with this kind of state "stateful",
27 and configurations without them "stateless".
28 (Even though stateless configurations contain state described in previous
29 paragraphs, and some configuration items may have "stateful" in their name,
30 such as stateful ACLs.)
31
32 # Stateful DUT configurations
33
34 Typically, the level of CPU impact of traffic depends on DUT state.
35 The first packets causing DUT state to change have higher impact,
36 subsequent packets matching that state have lower impact.
37
38 From performance point of view, this is similar to traffic phases
39 for stateful protocols, see
40 [NGFW draft](https://tools.ietf.org/html/draft-ietf-bmwg-ngfw-performance-05#section-4.3.4).
41 In CSIT we borrow the terminology (even if it does not fit perfectly,
42 see discussion below). Ramp-up traffic causes the state change,
43 sustain traffic does not change the state.
44
45 As the performance is different, each test has to choose which traffic
46 it wants to test, and manipulate the DUT state to achieve the intended impact.
47
48 ## Ramp-up trial
49
50 Tests aiming at sustain performance need to make sure DUT state is created.
51 We achieve this via a ramp-up trial, specific purpose of which
52 is to create the state.
53
54 Subsequent trials need no specific handling, as long as the state
55 remains the same. But some state can time-out, so additional ramp-up
56 trials are inserted whenever the code detects the state can time-out.
57 Note that a trial with zero loss refreshes the state,
58 so only the time since the last non-zero loss trial is tracked.
59
60 For the state to be set completely, it is important both DUT and TG
61 do not lose any packets. We achieve this by setting the profile multiplier
62 (TPS from now on) to low enough value.
63
64 It is also important each state-affecting packet is sent.
65 For size-limited traffic profile it is guaranteed by the size limit.
66 For continuous traffic, we set a long enough duration (based on TPS).
67
68 At the end of the ramp-up trial, we check DUT state to confirm
69 it has been created as expected.
70 Test fails if the state is not (completely) created.
71
72 ## State Reset
73
74 Tests aiming at ramp-up performance do not use ramp-up trial,
75 and they need to reset the DUT state before each trial measurement.
76 The way of resetting the state depends on test,
77 usually an API call is used to partially de-configure
78 the part that holds the state, and then re-configure it back.
79
80 In CSIT we control the DUT state behavior via a test variable "resetter".
81 If it is not set, DUT state is not reset.
82 If it is set, each search algorithm (including MRR) will invoke it
83 before all trial measurements (both main and telemetry ones).
84 Any configuration keyword enabling a feature with DUT state
85 will check whether a test variable for ramp-up rate is present.
86 If it is present, resetter is not set.
87 If it is not present, the keyword sets the apropriate resetter value.
88 This logic makes sure either ramp-up or state reset are used.
89
90 Notes: If both ramp-up and state reset were used, the DUT behavior
91 would be identical to just reset, while test would take longer to execute.
92 If neither were used, DUT will show different performance in subsequent trials,
93 violating assumptions of search algorithms.
94
95 ## DUT versus protocol ramp-up
96
97 There are at least three different causes for bandwidth possibly increasing
98 within a single measurement trial.
99
100 The first is DUT switching from state modification phase to constant phase,
101 it is the primary focus of this document.
102 Using ramp-up traffic before main trials eliminates this cause
103 for tests wishing to measure the performance of the next phase.
104 Using size-limited profiles eliminates the next phase
105 for tests wishing to measure performance of this phase.
106
107 The second is protocol such as TCP ramping up their throughput to utilize
108 the bandwidth available. This is the original meaning of "ramp up"
109 in the NGFW draft (see above).
110 In existing tests we are not using this meaning of TCP ramp-up.
111 Instead we use only small transactions, and large enough initial window
112 so TCP acts as ramped-up already.
113
114 The third is TCP increasing offered load due to retransmissions triggered by
115 packet loss. In CSIT we again try to avoid this behavior
116 by using small enough data to transfer, so overlap of multiple transactions
117 (primary cause of packet loss) is unlikely.
118 But in MRR tests, packet loss and non-constant offered load are still expected.
119
120 # Stateless DUT configuratons
121
122 These are simple configurations, which do not set any resetter value
123 (even if ramp-up duration is not configured).
124 Majority of existing tests are of this type, using continuous traffic profiles.
125
126 In order to identify limits of Trex performance,
127 we have added suites with stateless DUT configuration (VPP ip4base)
128 subjected to size-limited ASTF traffic.
129 The discovered rates serve as a basis of comparison
130 for evaluating the results for stateful DUT configurations (VPP NAT44ed)
131 subjected to the same traffic profiles.
132
133 # DUT versus TG state
134
135 Traffic Generator profiles can be stateful (ASTF) or stateless (STL).
136 DUT configuration can be stateful or stateless (with respect to packet traffic).
137
138 In CSIT we currently use all four possible configurations:
139
140 - Regular stateless VPP tests use stateless traffic profiles.
141
142 - Stateless VPP configuration with stateful profile is used as a base for
143   comparison.
144
145 - Some stateful DUT configurations (NAT44DET, NAT44ED unidirectional)
146   are tested using stateless traffic profiles and continuous traffic.
147
148 - The rest of stateful DUT configurations (NAT44ED bidirectional)
149   are tested using stateful traffic profiles and size limited traffic.