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