This patch is used to update the documents of D-release.
[kvmfornfv.git] / docs / userguide / low_latency.userguide.rst
1 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
2
3 .. http://creativecommons.org/licenses/by/4.0
4
5 Low Latency Environment
6 =======================
7
8 Achieving low latency with the KVM4NFV project requires setting up a special
9 test environment. This environment includes the BIOS settings, kernel
10 configuration, kernel parameters and the run-time environment.
11
12 Hardware Environment Description
13 --------------------------------
14
15 BIOS setup plays an important role in achieving real-time latency. A collection
16 of relevant settings, used on the platform where the baseline performance data
17 was collected, is detailed below:
18
19 CPU Features
20 ~~~~~~~~~~~~
21
22 Some special CPU features like TSC-deadline timer, invariant TSC and Process
23 posted interrupts, etc, are helpful for latency reduction.
24
25 CPU Topology
26 ~~~~~~~~~~~~
27
28 NUMA topology is also important for latency reduction.
29
30 BIOS Setup
31 ~~~~~~~~~~
32
33 Careful BIOS setup is important in achieving real time latency. Different
34 platforms have different BIOS setups, below are the important BIOS settings on
35 the platform used to collect the baseline performance data.
36
37 Software Environment Setup
38 --------------------------
39 Both the host and the guest environment need to be configured properly to
40 reduce latency variations.  Below are some suggested kernel configurations.
41 The ci/envs/ directory gives detailed implementation on how to setup the
42 environment.
43
44 Kernel Parameter
45 ~~~~~~~~~~~~~~~~
46
47 Please check the default kernel configuration in the source code at:
48 kernel/arch/x86/configs/opnfv.config.
49
50 Below is host kernel boot line example:
51
52 .. code:: bash
53
54    isolcpus=11-15,31-35 nohz_full=11-15,31-35 rcu_nocbs=11-15,31-35
55    iommu=pt intel_iommu=on default_hugepagesz=1G hugepagesz=1G mce=off idle=poll
56    intel_pstate=disable processor.max_cstate=1 pcie_asmp=off tsc=reliable
57
58 Below is guest kernel boot line example
59
60 .. code:: bash
61
62    isolcpus=1 nohz_full=1 rcu_nocbs=1 mce=off idle=poll default_hugepagesz=1G
63    hugepagesz=1G
64
65 Please refer to `tuning.userguide` for more explanation.
66
67 Run-time Environment Setup
68 ~~~~~~~~~~~~~~~~~~~~~~~~~~
69
70 Not only are special kernel parameters needed but a special run-time
71 environment is also required. Please refer to `tunning.userguide` for
72 more explanation.
73
74 Test cases to measure Latency
75 -----------------------------
76 The performance of the kvmfornfv is assesed by the latency values. Cyclictest and Packet forwarding
77 Test cases result in real time latency values of average, minimum and maximum.
78
79 * Cyclictest
80
81 * Packet Forwarding test
82
83 1. Cyclictest case
84 -------------------
85 Cyclictest results are the most frequently cited real-time Linux metric. The core concept of Cyclictest is very simple.
86 In KVMFORNFV cyclictest is implemented on the Guest-VM with 4.4-Kernel RPM installed. It generated Max,Min and Avg
87 values which help in assesing the kernel used. Cyclictest in currently divided into the following test types,
88
89 * Idle-Idle
90 * CPU_stress-Idle
91 * Memory_stress-Idle
92 * IO_stress-Idle
93
94 Future scope of work may include the below test-types,
95
96 * CPU_stress-CPU_stress
97 * Memory_stress-Memory_stress
98 * IO_stress-IO_stress
99
100 Understanding the naming convention
101 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
102
103 .. code:: bash
104
105    [Host-Type ] - [Guest-Type]
106
107 * **Host-Type  :** Mentions the type of stress applied on the kernel of the Host
108 * **Guest-Type :** Mentions the type of stress applied on the kernel of the Guest
109
110 Example.,
111
112 .. code:: bash
113
114     Idle - CPU_stress
115
116 The above name signifies that,
117
118 - No Stress is applied on the Host kernel
119
120 - CPU Stress is applied on the Guest kernel
121
122 **Note:**
123
124 - Stress is applied using the stress which is installed as part of the deployment.
125   Stress can be applied on CPU, Memory and Input-Output (Read/Write) operations using the stress tool.
126
127 Version Features
128 ~~~~~~~~~~~~~~~~
129
130 +-----------------------+------------------+-----------------+
131 | **Test Name**         | **Colorado**     | **Danube**      |
132 |                       |                  |                 |
133 +-----------------------+------------------+-----------------+
134 | - Idle - Idle         |     ``Y``        |     ``Y``       |
135 |                       |                  |                 |
136 | - Cpustress - Idle    |                  |     ``Y``       |
137 |                       |                  |                 |
138 | - Memorystress - Idle |                  |     ``Y``       |
139 |                       |                  |                 |
140 | - IOstress - Idle     |                  |     ``Y``       |
141 |                       |                  |                 |
142 +-----------------------+------------------+-----------------+
143
144
145 Idle-Idle test-type
146 ~~~~~~~~~~~~~~~~~~~
147 Cyclictest in run on the Guest VM when Host,Guest are not under any kind of stress. This is the basic
148 cyclictest of the KVMFORNFV project. Outputs Avg, Min and Max latency values.
149
150 .. figure:: images/idle-idle-test-type.png
151    :name: idle-idle test type
152    :width: 100%
153    :align: center
154
155 CPU_Stress-Idle test-type
156 ~~~~~~~~~~~~~~~~~~~~~~~~~
157 Here, the host is under CPU stress, where multiple times sqrt() function is called on kernel which
158 results increased CPU load. The cyclictest will run on the guest, where the guest is under no stress.
159 Outputs Avg, Min and Max latency values.
160
161 .. figure:: images/cpu-stress-idle-test-type.png
162    :name: cpu-stress-idle test type
163    :width: 100%
164    :align: center
165
166 Memory_Stress-Idle test-type
167 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
168 In this type, the host is under memory stress where continuos memory operations are implemented to
169 increase the Memory stress (Buffer stress).The cyclictest will run on the guest, where the guest is under
170 no stress. It outputs Avg, Min and Max latency values.
171
172 .. figure:: images/memory-stress-idle-test-type.png
173    :name: memory-stress-idle test type
174    :width: 100%
175    :align: center
176
177 IO_Stress-Idle test-type
178 ~~~~~~~~~~~~~~~~~~~~~~~~
179 The host is under constant Input/Output stress .i.e., multiple read-write operations are invoked to
180 increase stress. Cyclictest will run on the guest VM that is launched on the same host, where the guest
181 is under no stress. It outputs Avg, Min and Max latency values.
182
183 .. figure:: images/io-stress-idle-test-type.png
184    :name: io-stress-idle test type
185    :width: 100%
186    :align: center
187
188 CPU_Stress-CPU_Stress test-type
189 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
190 Not implemented for Danube release.
191
192 Memory_Stress-Memory_Stress test-type
193 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
194 Not implemented for Danube release.
195
196 IO_Stress-IO_Stress test type
197 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
198 Not implemented for Danube release.
199
200 2. Packet Forwarding Test cases
201 -------------------------------
202 Packet forwarding is an other test case of Kvmfornfv. It measures the time taken by a packet to return
203 to source after reaching its destination. This test case uses automated test-framework provided by
204 OPNFV VSWITCHPERF project and a traffic generator (IXIA is used for kvmfornfv). Only latency results
205 generating test cases are triggered as a part of kvmfornfv daily job.
206
207 Latency test measures the time required for a frame to travel from the originating device through the
208 network to the destination device. Please note that RFC2544 Latency measurement will be superseded with
209 a measurement of average latency over all successfully transferred packets or frames.
210
211 Packet forwarding test cases currently supports the following test types:
212
213 * Packet forwarding to Host
214
215 * Packet forwarding to Guest
216
217 * Packet forwarding to Guest using SRIOV
218
219 The testing approach adoped is black box testing, meaning the test inputs can be generated and the
220 outputs captured and completely evaluated from the outside of the System Under Test(SUT).
221
222 Packet forwarding to Host
223 ~~~~~~~~~~~~~~~~~~~~~~~~~
224 This is also known as Physical port → vSwitch → physical port deployment.
225 This test measures the time taken by the packet/frame generated by traffic generator(phy) to travel
226 through the network to the destination device(phy). This test results min,avg and max latency values.
227 This value signifies the performance of the installed kernel.
228
229 Packet flow,
230
231 .. figure:: images/host_pk_fw.png
232    :name: packet forwarding to host
233    :width: 100%
234    :align: center
235
236 Packet forwarding to Guest
237 ~~~~~~~~~~~~~~~~~~~~~~~~~~
238 This is also known as Physical port → vSwitch → VNF → vSwitch → physical port deployment.
239
240 This test measures the time taken by the packet/frame generated by traffic generator(phy) to travel
241 through the network involving a guest to the destination device(phy). This test results min,avg and
242 max latency values. This value signifies the performance of the installed kernel.
243
244 Packet flow,
245
246 .. figure:: images/guest_pk_fw.png
247    :name: packet forwarding to guest
248    :width: 100%
249    :align: center
250
251 Packet forwarding to Guest using SRIOV
252 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
253 This test is used to verify the VNF and measure the base performance (maximum forwarding rate in
254 fps and latency) that can be achieved by the VNF without a vSwitch. The performance metrics
255 collected by this test will serve as a key comparison point for NIC passthrough technologies and
256 vSwitches. VNF in this context refers to the hypervisor and the VM.
257
258 **Note:** The Vsperf running on the host is still required.
259
260 Packet flow,
261
262 .. figure:: images/sriov_pk_fw.png
263    :name: packet forwarding to guest using sriov
264    :width: 100%
265    :align: center