6c59f6555e32540c7fbd4c372fd7ebbbfbc5e5c2
[policy/parent.git] / docs / development / devtools / apex-s3p.rst
1 .. This work is licensed under a
2 .. Creative Commons Attribution 4.0 International License.
3 .. http://creativecommons.org/licenses/by/4.0
4
5 .. _apex-s3p-label:
6
7 .. toctree::
8    :maxdepth: 2
9
10 Policy APEX PDP component
11 ~~~~~~~~~~~~~~~~~~~~~~~~~
12
13 Setting up Stability Tests in APEX
14 ++++++++++++++++++++++++++++++++++
15
16 Introduction
17 ------------
18
19 The 72 hour Stability Test for apex-pdp has the goal of introducing a steady flow of transactions initiated from a test client server running JMeter. The pdp is configured to start a rest server inside it and take input from rest clients (JMeter) and send back output to the rest clients (JMeter).
20
21 The input events will be submitted through rest interface of apex-pdp and the results are verified using the rest responses coming out from apex-pdp.
22
23 The test will be performed in a multi-threaded environment where 20 threads running in JMeter will keep sending events to apex-pdp in every 500 milliseconds for the duration of 72 hours.
24
25 Setup details
26 -------------
27
28 The stability test is performed on VM's running in OpenStack cloud environment. There are 2 seperate VM's, one for running apex pdp & other one for running JMeter to simulate steady flow of transactions.
29
30
31 Install & Configure VisualVM
32 ----------------------------
33
34 VisualVM needs to be installed in the virtual machine having apex-pdp. It will be used to monitor CPU, Memory, GC for apex-pdp while stability test is running.
35
36 Install visualVM
37
38 .. code-block:: bash
39
40     sudo apt-get install visualvm
41
42 Login to VM using graphical interface in separate terminal window.
43
44 .. code-block:: bash
45
46     ssh -X <user>@<VM-IP-ADDRESS>
47
48 Open visualVM
49
50 .. code-block:: bash
51
52     visualvm &
53
54 Connect to apex-pdp JVM's JMX agent
55 1. Right click on "Local" in the left panel of the screen and select "Add Local JMX Connection..."
56 2. Enter localhost:9911 for "Connection", and click OK
57 3. Double click on the newly added nodes under "Local" to start monitoring CPU, Memory & GC.
58
59 Sample Screenshot of visualVM
60
61 .. image:: images/stability-visualvm1.PNG
62 .. image:: images/stability-visualvm2.PNG
63
64 Test Plan
65 ---------
66
67 The 72 hours stability test will run the following steps in 5 threaded loop.
68
69 - **Send Input Event** - sends an input message to rest interface of apex-pdp.
70 - **Assert Response Code** - assert the response code coming from apex-pdp.
71 - **Assert Response Message** - assert the response message coming from apex-pdp.
72
73 The following steps can be used to configure the parameters of test plan.
74
75 - **HTTP Header Manager** - used to store headers which will be used for making HTTP requests.
76 - **HTTP Request Defaults** -  used to store HTTP request details like Server Name or IP, Port, Protocol etc.
77 - **User Defined Variables** -  used to store following user defined parameters.
78
79 ==================  ============================================================================  ============================
80 **Name**            **Description**                                                               **Default Value**
81 ==================  ============================================================================  ============================
82 wait                Wait time after each request (in milliseconds)                                500
83 threads             Number of threads to run test cases in parallel.                              5
84 threadsTimeOutInMs  Synchronization timer for threads running in parallel (in milliseconds).      5000
85 ==================  ============================================================================  ============================
86
87
88 Download and update the jmx file presented in the apex-pdp git repository - `jmx file path <https://gerrit.onap.org/r/gitweb?p=policy/apex-pdp.git;a=tree;f=testsuites/apex-pdp-stability/src/main/resources;h=99d373033a190a690d4e05012bc3a656cae7bc3f;hb=refs/heads/master>`_.
89
90 - HTTPSampler.domain - The ip address of VM which the apex container is running
91 - HTTPSampler.port - The  listening port, here is 23324
92 - ThreadGroup.druation - Set the duration to 72 hours (in seconds)
93
94 Use the CLI mode to start the test
95
96 .. code-block:: bash
97
98     ./jmeter.sh -n -t ~/apexPdpStabilityTestPlan.jmx -Jusers=1 -l ~/stability.log
99
100 Stability Test Result
101 ---------------------
102
103 **Summary**
104
105 Stability test plan was triggered for 72 hours injecting input events to apex-pdp from 5 client threads.
106
107 Once the test has complete - we can generate a HTML test report via the following command
108
109 .. code-block:: bash
110
111     ~/jMeter/apache-jmeter-5.2.1/bin/jmeter -g stability.log -o ./result/
112
113 ==============================================  ================================  =============  ============ ============================
114 **Number of Client Threads running in JMeter**  **Total number of input events**  **Success %**  **Error %**  **Average Time per Request**
115 ==============================================  ================================  =============  ============ ============================
116 5                                               8594220                           100%           0%           5518.73
117 ==============================================  ================================  =============  ============ ============================
118
119 .. image:: images/stability-jmeter.PNG
120
121 :download:`result.zip <zip/frankfurt/apex_s3p_result.tar.gz>`
122
123
124 Stability Test of Apex PDP
125 ^^^^^^^^^^^^^^^^^^^^^^^^^^
126
127 The 72 hour Stability Test for apex-pdp has the goal of introducing a steady flow of transactions using jMeter.
128
129 The input event will be submitted through the rest interface of DMaaP , which then triggers a grpc request to CDS. Based on the response, another DMaaP event is triggered.
130
131 This test will be performed in an OOM deployment setup. The test will be performed in a multi-threaded environment where 5 threads running in JMeter will keep sending events for the duration of 72 hours.
132
133 Test Plan
134 ---------
135
136 The 72 hours stability test will run the following steps in a 5 threaded loop.
137
138 - **Create Policy** - creates a policy using the policy/api component
139 - **Deploy Policy** - deploys the policy in the existing PdpGroup
140 - **Check Health** - checks the health status of apex
141 - **Send Input Event** - trigger 'unauthenticated.DCAE_CL_OUTPUT' event of DMaaP.
142 - **Get Output Event Response** - check for the triggered output event.
143 - **Undeploy Policy** - undeploys the policy from PdpGroup
144 - **Delete Policy** - deletes the policy using the policy/api component
145
146 The following steps can be used to configure the parameters of the test plan.
147
148 - **HTTP Header Manager** - used to store headers which will be used for making HTTP requests.
149 - **HTTP Request Defaults** -  used to store HTTP request details like Server Name or IP, Port, Protocol etc.
150 - **User Defined Variables** -  used to store the following user defined parameters:
151
152 ==================  ============================================================================  ============================
153 **Name**            **Description**                                                               **Default Value**
154 ==================  ============================================================================  ============================
155 wait                Wait time after each request (in milliseconds)                                120000
156 threads             Number of threads to run test cases in parallel.                              5
157 threadsTimeOutInMs  Synchronization timer for threads running in parallel (in milliseconds).      150000
158 PAP_PORT            Port number of PAP for making REST API calls
159 API_PORT            Port number of API for making REST API calls
160 APEX_PORT           Port number of APEX for making REST API calls
161 DMAAP_PORT          Port number of DMAAP for making REST API calls
162 ==================  ============================================================================  ============================
163
164
165 Download and update the jmx file presented in the apex-pdp git repository - `jmx file path <https://gerrit.onap.org/r/gitweb?p=policy/apex-pdp.git;a=tree;f=testsuites/apex-pdp-stability/src/main/resources;h=99d373033a190a690d4e05012bc3a656cae7bc3f;hb=refs/heads/master>`_.
166
167 - HTTPSampler.domain - The ip address of the VM in which the apex container is running
168 - HTTPSampler.port - The  listening port, here is 23324
169 - ThreadGroup.duration - Set the duration to 72 hours (in seconds)
170
171 Use the CLI mode to start the test
172
173 .. code-block:: bash
174
175     nohup ./jmeter.sh -n -t ~/apexPdpStabilityTestPlan.jmx -Jusers=1 -l ~/stability.log
176
177
178 Stability Test Results
179 ----------------------
180
181 The stability test plan was triggered for 72 hours, injecting input events to apex-pdp pod from 5 client threads running in JMeter.
182
183 The stability tests were executed as part of a full ONAP OOM deployment in Nordix lab.
184
185 Once the tests complete, we can generate an HTML test report via the command:
186
187 .. code-block:: bash
188
189     ~/jMeter/apache-jmeter-5.2.1/bin/jmeter -g stability.log -o ./result/
190
191 ==============================================  ================================  =============  ============ ============================
192 **Number of Client Threads running in JMeter**  **Total number of input events**  **Success %**  **Error %**  **Average Time per Request**
193 ==============================================  ================================  =============  ============ ============================
194 5                                               8594220                           100%           0%           5518.73
195 ==============================================  ================================  =============  ============ ============================
196
197
198 **JMeter Screenshot**
199
200 .. image:: images/apex_s3p_jm-1.png
201 .. image:: images/apex_s3p_jm-2.png
202
203 :download:`result.zip <zip/frankfurt/apex_s3p_result.tar.gz>`
204
205 Setting up Performance Tests in APEX
206 ++++++++++++++++++++++++++++++++++++
207
208 The Performance test is performed on a similar setup to the Stability test. JMeter will send a large number of REST requests and will then retrieve those requests.
209
210 Performnce test plan will be the same as the stability test plan except for some differences listed below:
211
212 - Increase the number of threads from 5 to 60.
213 - Reduce test time to ninety minutes.
214 - Calculate the amount of requests handled in the time frame.
215
216 Run Test
217 --------
218
219 Running the performance test will be the same as the stability test. That is, launch JMeter pointing to corresponding *.jmx* test plan. The *API_HOST* , *API_PORT* , *PAP_HOST* , *PAP_PORT* are already set up in *.jmx*.
220
221 .. code-block:: bash
222
223     nohup ./jmeter.sh -n -t ~/performance.jmx -Jusers=1 -l ~/perf.log
224
225 Once the tests have completed, run the following the gather results.
226
227 .. code-block:: bash
228
229     ~/jMeter/apache-jmeter-5.2.1/bin/jmeter -g perf.log -o ./performance_result/
230
231 Performance Test Result
232 -----------------------
233
234 **Summary**
235
236 Performance test was triggered for 90 minutes. The results are shown below.
237
238 **Test Statistics**
239
240 ============================ =========== ========= ==================================
241 **Total Number of Requests** **Success** **Error** **Average Time Taken per Request**
242 ============================ =========== ========= ==================================
243 9870                         100 %       0 %       5506.09 ms
244 ============================ =========== ========= ==================================
245
246 **JMeter Screenshot**
247
248 .. image:: images/apex_perf_jm_1.png
249
250 .. image:: images/apex_perf_jm_2.png