blob: 6143e165184051849d2d6ce4ba8ba5ba343f795d [file] [log] [blame]
Pamela Dragoshba45dc62020-04-16 09:27:44 -04001.. 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
10Policy APEX PDP component
11~~~~~~~~~~~~~~~~~~~~~~~~~
12
13Setting up Stability Tests in APEX
14++++++++++++++++++++++++++++++++++
15
16Introduction
17------------
18
19The 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
21The 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
23The 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
25Setup details
26-------------
27
28The 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**OpenStack environment details**
31
32Version: Mitaka
33
34**apex-pdp VM details**
35
huaxingd51d9062020-05-20 15:21:53 +080036OS:Ubuntu 18.04 LTS
Pamela Dragoshba45dc62020-04-16 09:27:44 -040037
38CPU: 4 core
39
40RAM: 4 GB
41
42HardDisk: 40 GB
43
huaxingd51d9062020-05-20 15:21:53 +080044Docker Version: 19.03.8, build afacb8b7f0
Pamela Dragoshba45dc62020-04-16 09:27:44 -040045
huaxingd51d9062020-05-20 15:21:53 +080046Java: openjdk version "11.0.7"
Pamela Dragoshba45dc62020-04-16 09:27:44 -040047
48**JMeter VM details**
49
huaxingd51d9062020-05-20 15:21:53 +080050OS: Ubuntu 18.04 LTS
Pamela Dragoshba45dc62020-04-16 09:27:44 -040051
52CPU: 4 core
53
54RAM: 4 GB
55
56HardDisk: 40 GB
57
huaxingd51d9062020-05-20 15:21:53 +080058Java: openjdk version "11.0.7"
Pamela Dragoshba45dc62020-04-16 09:27:44 -040059
huaxingd51d9062020-05-20 15:21:53 +080060JMeter: 5.2.1
Pamela Dragoshba45dc62020-04-16 09:27:44 -040061
62Install JMeter in virtual machine
63---------------------------------
64
65Make the etc/hosts entries
66
67.. code-block:: bash
huaxingd51d9062020-05-20 15:21:53 +080068
Pamela Dragoshba45dc62020-04-16 09:27:44 -040069 echo $(hostname -I | cut -d\ -f1) $(hostname) | sudo tee -a /etc/hosts
huaxingd51d9062020-05-20 15:21:53 +080070
Pamela Dragoshba45dc62020-04-16 09:27:44 -040071Make the DNS entries
72
73.. code-block:: bash
74
75 echo "nameserver <PrimaryDNSIPIP>" >> sudo /etc/resolvconf/resolv.conf.d/head
huaxingd51d9062020-05-20 15:21:53 +080076
Pamela Dragoshba45dc62020-04-16 09:27:44 -040077 echo "nameserver <SecondaryDNSIP>" >> sudo /etc/resolvconf/resolv.conf.d/head
huaxingd51d9062020-05-20 15:21:53 +080078
Pamela Dragoshba45dc62020-04-16 09:27:44 -040079 resolvconf -u
80
81Update the ubuntu software installer
82
83.. code-block:: bash
84
85 apt-get update
huaxingd51d9062020-05-20 15:21:53 +080086
Pamela Dragoshba45dc62020-04-16 09:27:44 -040087Check & Install Java
88
89.. code-block:: bash
90
huaxingd51d9062020-05-20 15:21:53 +080091 apt-get install -y openjdk-11-jdk
92
Pamela Dragoshba45dc62020-04-16 09:27:44 -040093 java -version
94
95Download & install JMeter
96
97.. code-block:: bash
98
99 mkdir jMeter
huaxingd51d9062020-05-20 15:21:53 +0800100
101
Pamela Dragoshba45dc62020-04-16 09:27:44 -0400102 cd jMeter
huaxingd51d9062020-05-20 15:21:53 +0800103
104
105 wget http://mirrors.whoishostingthis.com/apache//jmeter/binaries/apache-jmeter-5.2.1.zip
106
107
108 unzip apache-jmeter-5.2.1.zip
Pamela Dragoshba45dc62020-04-16 09:27:44 -0400109
110Install apex-pdp in virtual machine
111-----------------------------------
112
113We will be running apex-pdp as docker container. So we need to first install docker and then create the container hosting apex-pdp by pulling the image from ONAP repository.
114
115**Docker Installation**
116
1171. Make the etc/hosts entries
118
119.. code-block:: bash
120
121 echo $(hostname -I | cut -d\ -f1) $(hostname) | sudo tee -a /etc/hosts
huaxingd51d9062020-05-20 15:21:53 +0800122
Pamela Dragoshba45dc62020-04-16 09:27:44 -04001232. Make the DNS entries
124
125.. code-block:: bash
126
127 echo "nameserver <PrimaryDNSIPIP>" >> sudo /etc/resolvconf/resolv.conf.d/head
128 echo "nameserver <SecondaryDNSIP>" >> sudo /etc/resolvconf/resolv.conf.d/head
129 resolvconf -u
130
1313. Update the ubuntu software installer
132
133.. code-block:: bash
134
135 apt-get update
136
1374. Check and Install Java
138
139.. code-block:: bash
140
huaxingd51d9062020-05-20 15:21:53 +0800141 apt-get install -y openjdk-11-jdk
Pamela Dragoshba45dc62020-04-16 09:27:44 -0400142 java -version
143
144Ensure that the Java version that is executing is OpenJDK version 8
145
1465. Check and install docker
147
148.. code-block:: bash
149
150 curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
huaxingd51d9062020-05-20 15:21:53 +0800151 sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
152 sudo apt-get update
153 sudo apt-cache policy docker-ce
154 sudo apt-get install -y docker-ce
155 sudo systemctl enable docker
156 sudo systemctl start docker
157 sudo usermod -aG docker <your user id>
Pamela Dragoshba45dc62020-04-16 09:27:44 -0400158
huaxingd51d9062020-05-20 15:21:53 +08001596. Logout and re-login to ensure the ``usermod`` command takes effective
Pamela Dragoshba45dc62020-04-16 09:27:44 -0400160
1617. Check the status of the Docker service and ensure it is running correctly
162
163.. code-block:: bash
164
Pamela Dragoshba45dc62020-04-16 09:27:44 -0400165 docker ps
166
167**Install apex-pdp**
168
169Run the below command to create the container hosting apex-pdp by pulling the image from ONAP repository.
170
171.. code-block:: bash
172
huaxingd51d9062020-05-20 15:21:53 +0800173 docker run -d --name apex -p 12561:12561 -p 23324:23324 -p 9911:9911 nexus3.onap.org:10001/onap/policy-apex-pdp:2.3.1 /bin/bash -c "/opt/app/policy/apex-pdp/bin/apexApps.sh jmx-test -c /opt/app/policy/apex-pdp/examples/config/SampleDomain/RESTServerJsonEvent.json"
Pamela Dragoshba45dc62020-04-16 09:27:44 -0400174 docker ps
175
176Note: If you observe that requests from JMeter client is failing due to timeout, then modify the "RESTServerJsonEvent.json" mentioned in the above command and increase the "synchronousTimeout" property as per needed.
177
178Install & Configure VisualVM
179----------------------------
180
181VisualVM 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.
182
183Install visualVM
184
185.. code-block:: bash
186
187 sudo apt-get install visualvm
188
Pamela Dragoshba45dc62020-04-16 09:27:44 -0400189Login to VM using graphical interface in separate terminal window.
190
191.. code-block:: bash
192
193 ssh -X <user>@<VM-IP-ADDRESS>
194
195Open visualVM
196
197.. code-block:: bash
198
199 visualvm &
Pamela Dragoshba45dc62020-04-16 09:27:44 -0400200
huaxingd51d9062020-05-20 15:21:53 +0800201Connect to apex-pdp JVM's JMX agent
2021. Right click on "Local" in the left panel of the screen and select "Add Local JMX Connection..."
2032. Enter localhost:9911 for "Connection", and click OK
2043. Double click on the newly added nodes under "Local" to start monitoring CPU, Memory & GC.
Pamela Dragoshba45dc62020-04-16 09:27:44 -0400205
206Sample Screenshot of visualVM
207
huaxingd51d9062020-05-20 15:21:53 +0800208.. image:: images/stability-visualvm1.PNG
209.. image:: images/stability-visualvm2.PNG
Pamela Dragoshba45dc62020-04-16 09:27:44 -0400210
211Test Plan
212---------
213
214The 72 hours stability test will run the following steps in 20 threaded loop.
215
216- **Send Input Event** - sends an input message to rest interface of apex-pdp.
217- **Assert Response Code** - assert the response code coming from apex-pdp.
218- **Assert Response Message** - assert the response message coming from apex-pdp.
219
220The following steps can be used to configure the parameters of test plan.
221
222- **HTTP Header Manager** - used to store headers which will be used for making HTTP requests.
223- **HTTP Request Defaults** - used to store HTTP request details like Server Name or IP, Port, Protocol etc.
224- **User Defined Variables** - used to store following user defined parameters.
225
226================== ============================================================================ ============================
227**Name** **Description** **Default Value**
228================== ============================================================================ ============================
229wait Wait time after each request (in milliseconds) 500
230threads Number of threads to run test cases in parallel. 20
231threadsTimeOutInMs Synchronization timer for threads running in parallel (in milliseconds). 5000
232================== ============================================================================ ============================
233
234
235Download 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>`_.
236
237- HTTPSampler.domain - The ip address of VM which the apex container is running
238- HTTPSampler.port - The listening port, here is 23324
239- ThreadGroup.druation - Set the duration to 72 hours (in seconds)
240
241Use the CLI mode to start the test
242
243.. code-block:: bash
244
245 ./jmeter.sh -n -t ~/apexPdpStabilityTestPlan.jmx -Jusers=1 -l ~/stability.log
246
247Stability Test Result
248---------------------
249
250**Summary**
251
252Stability test plan was triggered for 72 hours injecting input events to apex-pdp from 20 client threads running in JMeter.
253
254After the test stop, we can generate a HTML test report via command
255
256.. code-block:: bash
257
huaxingd51d9062020-05-20 15:21:53 +0800258 ~/jMeter/apache-jmeter-5.2.1/bin/jmeter -g stability.log -o ./result/
Pamela Dragoshba45dc62020-04-16 09:27:44 -0400259
260============================================== =================================================== ================================ ============= ============
261**Number of Client Threads running in JMeter** **Number of Server Threads running in Apex engine** **Total number of input events** **Success %** **Error %**
262============================================== =================================================== ================================ ============= ============
huaxingd51d9062020-05-20 15:21:53 +080026320 4 8594220 100% 0%
Pamela Dragoshba45dc62020-04-16 09:27:44 -0400264============================================== =================================================== ================================ ============= ============
265
huaxingd51d9062020-05-20 15:21:53 +0800266.. image:: images/stability-jmeter.PNG
Pamela Dragoshba45dc62020-04-16 09:27:44 -0400267
liamfallon75f95322020-07-07 10:36:59 +0100268:download:`result.zip <zip/frankfurt/apex_s3p_result.tar.gz>`
Pamela Dragoshba45dc62020-04-16 09:27:44 -0400269
aditya.puthuparambil9d4e96e2020-06-02 12:10:24 +0100270
271Frankfurt release
272^^^^^^^^^^^^^^^^^^
273
274The 72 hour Stability Test for apex-pdp has the goal of introducing a steady flow of transactions using jMeter.
275
276The 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.
277
278This 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.
279
280Test Plan Frankfurt release
281---------------------------
282
283The 72 hours stability test will run the following steps in a 5 threaded loop.
284
285- **Create Policy** - creates a policy using the policy/api component
286- **Deploy Policy** - deploys the policy in the existing PdpGroup
287- **Check Health** - checks the health status of apex
288- **Send Input Event** - trigger 'unauthenticated.DCAE_CL_OUTPUT' event of DMaaP.
289- **Get Output Event Response** - check for the triggered output event.
290- **Undeploy Policy** - undeploys the policy from PdpGroup
291- **Delete Policy** - deletes the policy using the policy/api component
292
293The following steps can be used to configure the parameters of the test plan.
294
295- **HTTP Header Manager** - used to store headers which will be used for making HTTP requests.
296- **HTTP Request Defaults** - used to store HTTP request details like Server Name or IP, Port, Protocol etc.
297- **User Defined Variables** - used to store the following user defined parameters:
298
299================== ============================================================================ ============================
300**Name** **Description** **Default Value**
301================== ============================================================================ ============================
302wait Wait time after each request (in milliseconds) 120000
303threads Number of threads to run test cases in parallel. 5
304threadsTimeOutInMs Synchronization timer for threads running in parallel (in milliseconds). 150000
305================== ============================================================================ ============================
306
307
308Download 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>`_.
309
310- HTTPSampler.domain - The ip address of the VM in which the apex container is running
311- HTTPSampler.port - The listening port, here is 23324
312- ThreadGroup.druation - Set the duration to 72 hours (in seconds)
313
314Use the CLI mode to start the test
315
316.. code-block:: bash
317
318 ./jmeter.sh -n -t ~/apexPdpStabilityTestPlan.jmx -Jusers=1 -l ~/stability.log
319
320
321Stability Test Results Frankfurt release
322-----------------------------------------
323
324The stability test plan was triggered for 72 hours, injecting input events to apex-pdp from 5 client threads running in JMeter.
325
326After the test stops, we can generate an HTML test report via the command:
327
328.. code-block:: bash
329
330 ~/jMeter/apache-jmeter-5.2.1/bin/jmeter -g stability.log -o ./result/
331
332============================================== =================================================== ================================ ============= ============
333**Number of Client Threads running in JMeter** **Number of Server Threads running in Apex engine** **Total number of input events** **Success %** **Error %**
334============================================== =================================================== ================================ ============= ============
3355 4 26766 100% 0%
336============================================== =================================================== ================================ ============= ============
337
338**VisualVM Screenshot**
339
340.. image:: images/frankfurt/apex_s3p_vm-1.png
341.. image:: images/frankfurt/apex_s3p_vm-2.png
342
343**JMeter Screenshot**
344
345.. image:: images/frankfurt/apex_s3p_jm-1.png
346.. image:: images/frankfurt/apex_s3p_jm-2.png
347
liamfallon75f95322020-07-07 10:36:59 +0100348:download:`result.zip <zip/frankfurt/apex_s3p_result.tar.gz>`
aditya.puthuparambil9d4e96e2020-06-02 12:10:24 +0100349
Pamela Dragoshba45dc62020-04-16 09:27:44 -0400350Setting up Performance Tests in APEX
351++++++++++++++++++++++++++++++++++++
352
huaxingd51d9062020-05-20 15:21:53 +0800353The apex-pdp has built in support for performance testing. A special performance testing REST server is available in the code base for performance testing.
354It is in the module `performance-benchmark-test <https://github.com/onap/policy-apex-pdp/tree/master/testsuites/performance/performance-benchmark-test>`_.
355To execute a benchmark test, you start the REST server, and then configure and run APEX against the server.
Pamela Dragoshba45dc62020-04-16 09:27:44 -0400356There are example configurations for running tests in the `resources of this module <https://github.com/onap/policy-apex-pdp/tree/master/testsuites/performance/performance-benchmark-test/src/main/resources/examples/benchmark>`_.
357
358In order to run the test for 72 hours, set the batch count in the `EventGeneratorConfig.json <https://github.com/onap/policy-apex-pdp/blob/master/testsuites/performance/performance-benchmark-test/src/main/resources/examples/benchmark/EventGeneratorConfig.json>`_ file to zero, which causes the REST server to generate batches forever.
359
360Here is an example of how to do this:
361
3621. Clone and build the apex-pdp git repo
363
3642. Go into the performance-benchmark-test module and run the REST server
365
366.. code-block:: bash
367
368 cd testsuites/performance/performance-benchmark-test
369 mvn exec:java -Dexec.mainClass="org.onap.policy.apex.testsuites.performance.benchmark.eventgenerator.EventGenerator" -Dexec.args="-c src/main/resources/examples/benchmark/EventGeneratorConfig.json"
370
3713. Separately, create a local directory and unzip the APEX tarball
372
373.. code-block:: bash
374
375 mkdir apex
376 cd apex
377 tar zxvf ~/git/onap/policy/apex-pdp/packages/apex-pdp-package-full/target/*gz
huaxingd51d9062020-05-20 15:21:53 +0800378
Pamela Dragoshba45dc62020-04-16 09:27:44 -04003794. Run APEX with a configuration that runs against the benchmark REST server, select the configuration that is appropriate for the number of threads for the number of cores on the host on which APEX is running. For example on a 32 core machine, select the "32" configuration, on an 8 core machine, select the "08" configuration.
380
381.. code-block:: bash
382
383 bin/apexApps.sh engine -c ~/git/onap/policy/apex-pdp/testsuites/performance/performance-benchmark-test/src/main/resources/examples/benchmark/Javascript64.json
huaxingd51d9062020-05-20 15:21:53 +0800384
Pamela Dragoshba45dc62020-04-16 09:27:44 -04003855. To get the test results, Issue the following command using CURL or from a browser(also can store the result into a file by setting outfile in the `EventGeneratorConfig.json <https://github.com/onap/policy-apex-pdp/blob/master/testsuites/performance/performance-benchmark-test/src/main/resources/examples/benchmark/EventGeneratorConfig.json>`_ file, statistics would be written into this file after event generator terminated)
huaxingd51d9062020-05-20 15:21:53 +0800386
Pamela Dragoshba45dc62020-04-16 09:27:44 -0400387.. code-block:: bash
388
389 curl http://localhost:32801/EventGenerator/Stats
huaxingd51d9062020-05-20 15:21:53 +0800390
Pamela Dragoshba45dc62020-04-16 09:27:44 -0400391The results are similar to those below:
huaxingd51d9062020-05-20 15:21:53 +0800392
Pamela Dragoshba45dc62020-04-16 09:27:44 -0400393:download:`Example APEX performance metrics <json/example-apex-perf.json>`
394
huaxingd51d9062020-05-20 15:21:53 +0800395Performance Test Result Frankfurt
Pamela Dragosh6eec8752020-05-21 11:06:03 -0400396---------------------------------
Pamela Dragoshba45dc62020-04-16 09:27:44 -0400397
398**Summary**
399
huaxingd51d9062020-05-20 15:21:53 +0800400Performance test was triggered for 2 hours on a 4 core, 4GB RAM virtual machine.
Pamela Dragoshba45dc62020-04-16 09:27:44 -0400401
402**Test Statistics**
403
huaxingd51d9062020-05-20 15:21:53 +0800404:download:`Attached result log <json/frankfurt-apex-perf.json>`
Pamela Dragoshba45dc62020-04-16 09:27:44 -0400405
406=============== ============= ================= ============== ===================== ================== ============= ===========
407**batchNumber** **batchSize** **eventsNotSent** **eventsSent** **eventsNotReceived** **eventsReceived** **Success %** **Error %**
408=============== ============= ================= ============== ===================== ================== ============= ===========
huaxingd51d9062020-05-20 15:21:53 +0800409-1 431250 0 431250 0 431250 100 % 0 %
Pamela Dragoshba45dc62020-04-16 09:27:44 -0400410=============== ============= ================= ============== ===================== ================== ============= ===========
411
412======================== ========================= ========================
413**averageRoundTripNano** **shortestRoundTripNano** **longestRoundTripNano**
414======================== ========================= ========================
huaxingd51d9062020-05-20 15:21:53 +0800415148965724 20169907 429339393
Pamela Dragoshba45dc62020-04-16 09:27:44 -0400416======================== ========================= ========================
417
418============================ ============================= ============================
419**averageApexExecutionNano** **shortestApexExecutionNano** **longestApexExecutionNano**
420============================ ============================= ============================
huaxingd51d9062020-05-20 15:21:53 +080042162451899 3901010 354528579
Pamela Dragoshba45dc62020-04-16 09:27:44 -0400422============================ ============================= ============================