Remove css files from apex-pdp s3p results
[policy/parent.git] / docs / development / devtools / apex-s3p.rst
index 6bc006a..e3a5d7e 100644 (file)
@@ -27,377 +27,224 @@ Setup details
 
 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.
 
-**OpenStack environment details**
 
-Version: Mitaka
-
-**apex-pdp VM details**
-
-OS:Ubuntu 16.04.5 LTS
-
-CPU: 4 core
-
-RAM: 4 GB
-
-HardDisk: 40 GB
-
-Docker Version: 18.06.1-ce, build e68fc7a
-
-Java: openjdk version "1.8.0_181"
-
-**JMeter VM details**
-
-OS: Ubuntu 16.04.3 LTS
-
-CPU: 4 core
-
-RAM: 4 GB
-
-HardDisk: 40 GB
-
-Java: openjdk version "1.8.0_181"
-
-JMeter: 5.1.1
-
-Install JMeter in virtual machine
----------------------------------
-
-Make the etc/hosts entries
-
-.. code-block:: bash
-    
-    echo $(hostname -I | cut -d\  -f1) $(hostname) | sudo tee -a /etc/hosts
-    
-Make the DNS entries
-
-.. code-block:: bash
-
-    echo "nameserver <PrimaryDNSIPIP>" >> sudo /etc/resolvconf/resolv.conf.d/head
-      
-    echo "nameserver <SecondaryDNSIP>" >> sudo /etc/resolvconf/resolv.conf.d/head
-      
-    resolvconf -u
-
-Update the ubuntu software installer
-
-.. code-block:: bash
-
-    apt-get update
-    
-Check & Install Java
-
-.. code-block:: bash
-
-    apt-get install -y openjdk-8-jdk
-  
-    java -version
-
-Download & install JMeter
-
-.. code-block:: bash
-
-    mkdir jMeter
-     
-     
-    cd jMeter
-     
-     
-    wget http://mirrors.whoishostingthis.com/apache//jmeter/binaries/apache-jmeter-5.1.1.zip
-     
-     
-    unzip apache-jmeter-5.1.1.zip 
-
-Install apex-pdp in virtual machine
------------------------------------
-
-We 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.
-
-**Docker Installation**
-
-1. Make the etc/hosts entries
-
-.. code-block:: bash
-
-    echo $(hostname -I | cut -d\  -f1) $(hostname) | sudo tee -a /etc/hosts
-    
-2. Make the DNS entries
-
-.. code-block:: bash
-
-    echo "nameserver <PrimaryDNSIPIP>" >> sudo /etc/resolvconf/resolv.conf.d/head
-    echo "nameserver <SecondaryDNSIP>" >> sudo /etc/resolvconf/resolv.conf.d/head
-    resolvconf -u
-
-3. Update the ubuntu software installer
-
-.. code-block:: bash
-
-    apt-get update
-
-4. Check and Install Java
-
-.. code-block:: bash
-
-    apt-get install -y openjdk-8-jdk
-    java -version
+Install & Configure VisualVM
+----------------------------
 
-Ensure that the Java version that is executing is OpenJDK version 8
+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.
 
-5. Check and install docker
+Install visualVM
 
 .. code-block:: bash
 
-    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
-    add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
-    apt-get update
-    apt-cache policy docker-ce
-    apt-get install -y docker-ce
-    systemctl status docker
-    docker ps
+    sudo apt-get install visualvm
 
-6. Change the permissions of the Docker socket file
+Login to VM using graphical interface in separate terminal window.
 
 .. code-block:: bash
 
-    chmod 777 /var/run/docker.sock
+    ssh -X <user>@<VM-IP-ADDRESS>
 
-7. Check the status of the Docker service and ensure it is running correctly
+Open visualVM
 
 .. code-block:: bash
 
-    service docker status
-    docker ps
-
-**Install apex-pdp**
-
-Run the below command to create the container hosting apex-pdp by pulling the image from ONAP repository.
+    visualvm &
 
-.. code-block:: bash
+Connect to apex-pdp JVM's JMX agent
+1. Right click on "Local" in the left panel of the screen and select "Add Local JMX Connection..."
+2. Enter localhost:9911 for "Connection", and click OK
+3. Double click on the newly added nodes under "Local" to start monitoring CPU, Memory & GC.
 
-    docker run -d --name apex -p 12561:12561 -p 23324:23324 -it nexus3.onap.org:10001/onap/policy-apex-pdp:2.1.0-latest /bin/bash -c "/opt/app/policy/apex-pdp/bin/apexApps.sh jmx-test -c /opt/app/policy/apex-pdp/examples/config/SampleDomain/RESTServerJsonEvent.json"
-    docker ps
+Sample Screenshot of visualVM
 
-Note: 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.
+.. image:: images/stability-visualvm1.PNG
+.. image:: images/stability-visualvm2.PNG
 
-Install & Configure VisualVM
-----------------------------
+Test Plan
+---------
 
-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.
+The 72 hours stability test will run the following steps in 5 threaded loop.
 
-Install visualVM
+- **Send Input Event** - sends an input message to rest interface of apex-pdp.
+- **Assert Response Code** - assert the response code coming from apex-pdp.
+- **Assert Response Message** - assert the response message coming from apex-pdp.
 
-.. code-block:: bash
+The following steps can be used to configure the parameters of test plan.
 
-    sudo apt-get install visualvm
+- **HTTP Header Manager** - used to store headers which will be used for making HTTP requests.
+- **HTTP Request Defaults** -  used to store HTTP request details like Server Name or IP, Port, Protocol etc.
+- **User Defined Variables** -  used to store following user defined parameters.
 
-Login to docker container (using root)
+==================  ============================================================================  ============================
+**Name**            **Description**                                                               **Default Value**
+==================  ============================================================================  ============================
+wait                Wait time after each request (in milliseconds)                                500
+threads             Number of threads to run test cases in parallel.                              5
+threadsTimeOutInMs  Synchronization timer for threads running in parallel (in milliseconds).      5000
+==================  ============================================================================  ============================
 
-.. code-block:: bash
 
-    docker exec -u 0 -it apex /bin/bash
-    
-Run few commands to configure permissions
+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>`_.
 
-.. code-block:: bash
+- HTTPSampler.domain - The ip address of VM which the apex container is running
+- HTTPSampler.port - The  listening port, here is 23324
+- ThreadGroup.druation - Set the duration to 72 hours (in seconds)
 
-    cd /usr/lib/jvm/java-1.8-openjdk/bin/
-    touch visualvm.policy
-     
-    vi visualvm.policy
-     
-    Add the following in visualvm.policy
-     
-     
-    grant codebase "file:/usr/lib/jvm/java-1.8-openjdk/lib/tools.jar" {
-       permission java.security.AllPermission;
-    };
-     
-     
-    chmod 777 visualvm.policy
-     
-     
-    exit
-
-Login to docker container (using normal user)
+Use the CLI mode to start the test
 
 .. code-block:: bash
 
-    docker exec -it apex /bin/bash
+    ./jmeter.sh -n -t ~/apexPdpStabilityTestPlan.jmx -Jusers=1 -l ~/stability.log
 
-Run following commands to start jstatd using port 1111
+Stability Test Result
+---------------------
 
-.. code-block:: bash
+**Summary**
 
-    cd /usr/lib/jvm/java-1.8-openjdk/bin/
-     
-     
-    ./jstatd -p 1111 -J-Djava.security.policy=visualvm.policy  &
-     
-     
-    exit
+Stability test plan was triggered for 72 hours injecting input events to apex-pdp from 5 client threads.
 
-Login to VM using graphical interface in separate terminal window.
+Once the test has complete - we can generate a HTML test report via the following command
 
 .. code-block:: bash
 
-    ssh -X <user>@<VM-IP-ADDRESS>
-
-Open visualVM
+    ~/jMeter/apache-jmeter-5.2.1/bin/jmeter -g stability.log -o ./result/
 
-.. code-block:: bash
+==============================================  ================================  =============  ============ ============================
+**Number of Client Threads running in JMeter**  **Total number of input events**  **Success %**  **Error %**  **Average Time per Request**
+==============================================  ================================  =============  ============ ============================
+5                                               8594220                           100%           0%           5518.73
+==============================================  ================================  =============  ============ ============================
 
-    visualvm &
-    
-Connect to jstatd & remote apex-pdp JVM
+.. image:: images/stability-jmeter.PNG
 
-1. Right click on "Remote" in the left panel of the screen and select "Add Remote Host..."
+:download:`result.zip <apex-s3p-results/apex_s3p_results.zip>`
 
-2. Enter the IP address of apex-pdp docker container.
 
-.. code-block:: bash
-    
-    docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' container_name_or_id
+Stability Test of Apex PDP
+^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-3. Right click on IP address, select "Add jstatd Connection..."
-4. In "jstatd Connections" tab, enter port 1111 and click OK.
-5. Right click on IP address, select "Add JMX Connection..."
-6. Enter the apex-pdp docker container IP Address (from step 2) <IP address>:9911 ( for example - 172.17.0.2:9911) and click OK.
-7. Double click on the newly added nodes under "Remote" to start monitoring CPU, Memory & GC.
+The 72 hour Stability Test for apex-pdp has the goal of introducing a steady flow of transactions using jMeter.
 
-Sample Screenshot of visualVM
+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.
 
-.. image:: images/apex-s3p-vvm-sample.jpg
+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.
 
 Test Plan
 ---------
 
-The 72 hours stability test will run the following steps in 20 threaded loop.
+The 72 hours stability test will run the following steps in a 5 threaded loop.
 
-- **Send Input Event** - sends an input message to rest interface of apex-pdp.
-- **Assert Response Code** - assert the response code coming from apex-pdp.
-- **Assert Response Message** - assert the response message coming from apex-pdp.
+- **Create Policy** - creates a policy using the policy/api component
+- **Deploy Policy** - deploys the policy in the existing PdpGroup
+- **Check Health** - checks the health status of apex
+- **Send Input Event** - trigger 'unauthenticated.DCAE_CL_OUTPUT' event of DMaaP.
+- **Get Output Event Response** - check for the triggered output event.
+- **Undeploy Policy** - undeploys the policy from PdpGroup
+- **Delete Policy** - deletes the policy using the policy/api component
 
-The following steps can be used to configure the parameters of test plan.
+The following steps can be used to configure the parameters of the test plan.
 
 - **HTTP Header Manager** - used to store headers which will be used for making HTTP requests.
 - **HTTP Request Defaults** -  used to store HTTP request details like Server Name or IP, Port, Protocol etc.
-- **User Defined Variables** -  used to store following user defined parameters.
+- **User Defined Variables** -  used to store the following user defined parameters:
 
 ==================  ============================================================================  ============================
 **Name**            **Description**                                                               **Default Value**
 ==================  ============================================================================  ============================
-wait                Wait time after each request (in milliseconds)                                500
-threads             Number of threads to run test cases in parallel.                              20
-threadsTimeOutInMs  Synchronization timer for threads running in parallel (in milliseconds).      5000
+wait                Wait time after each request (in milliseconds)                                120000
+threads             Number of threads to run test cases in parallel.                              5
+threadsTimeOutInMs  Synchronization timer for threads running in parallel (in milliseconds).      150000
+PAP_PORT            Port number of PAP for making REST API calls
+API_PORT            Port number of API for making REST API calls
+APEX_PORT           Port number of APEX for making REST API calls
+DMAAP_PORT          Port number of DMAAP for making REST API calls
 ==================  ============================================================================  ============================
 
 
 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>`_.
 
-- HTTPSampler.domain - The ip address of VM which the apex container is running
+- HTTPSampler.domain - The ip address of the VM in which the apex container is running
 - HTTPSampler.port - The  listening port, here is 23324
-- ThreadGroup.druation - Set the duration to 72 hours (in seconds)
+- ThreadGroup.duration - Set the duration to 72 hours (in seconds)
 
 Use the CLI mode to start the test
 
 .. code-block:: bash
 
-    ./jmeter.sh -n -t ~/apexPdpStabilityTestPlan.jmx -Jusers=1 -l ~/stability.log
+    nohup ./jmeter.sh -n -t ~/apexPdpStabilityTestPlan.jmx -Jusers=1 -l ~/stability.log
 
-Stability Test Result
----------------------
 
-**Summary**
+Stability Test Results
+----------------------
 
-Stability test plan was triggered for 72 hours injecting input events to apex-pdp from 20 client threads running in JMeter.
+The stability test plan was triggered for 72 hours, injecting input events to apex-pdp pod from 5 client threads running in JMeter.
 
-After the test stop, we can generate a HTML test report via command
+The stability tests were executed as part of a full ONAP OOM deployment in Nordix lab.
 
-.. code-block:: bash
+Once the tests complete, we can generate an HTML test report via the command:
 
-    ~/jMeter/apache-jmeter-5.1.1/bin/jmeter -g stability.log -o ./result/
+.. code-block:: bash
 
-==============================================  ===================================================  ================================  =============  ============
-**Number of Client Threads running in JMeter**  **Number of Server Threads running in Apex engine**  **Total number of input events**  **Success %**  **Error %**
-==============================================  ===================================================  ================================  =============  ============
-20                                              4                                                    6394602                           99.999971%     0.0029%
-==============================================  ===================================================  ================================  =============  ============
+    ~/jMeter/apache-jmeter-5.2.1/bin/jmeter -g stability.log -o ./result/
 
-:download:`result.zip <zip/result.zip>`
-:download:`onap.zip <zip/onap.zip>`
+==============================================  ================================  =============  ============ ============================
+**Number of Client Threads running in JMeter**  **Total number of input events**  **Success %**  **Error %**  **Average Time per Request**
+==============================================  ================================  =============  ============ ============================
+5                                               8594220                           100%           0%           5518.73
+==============================================  ================================  =============  ============ ============================
 
 
-Setting up Performance Tests in APEX
-++++++++++++++++++++++++++++++++++++
+**JMeter Screenshot**
 
-The apex-pdp has built in support for performance testing. A special performance testing REST server is available in the code base for performance testing. 
-It is in the module `performance-benchmark-test <https://github.com/onap/policy-apex-pdp/tree/master/testsuites/performance/performance-benchmark-test>`_. 
-To execute a benchmark test, you start the REST server, and then configure and run APEX against the server. 
-There 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>`_.
+.. image:: images/apex_s3p_jm-1.png
+.. image:: images/apex_s3p_jm-2.png
 
-In 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.
+:download:`result.zip <apex-s3p-results/apex_s3p_results.zip>`
 
-Here is an example of how to do this:
+Setting up Performance Tests in APEX
+++++++++++++++++++++++++++++++++++++
 
-1. Clone and build the apex-pdp git repo
+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.
 
-2. Go into the performance-benchmark-test module and run the REST server
+Performnce test plan will be the same as the stability test plan except for some differences listed below:
 
-.. code-block:: bash
+- Increase the number of threads from 5 to 60.
+- Reduce test time to ninety minutes.
+- Calculate the amount of requests handled in the time frame.
 
-    cd testsuites/performance/performance-benchmark-test
-    mvn exec:java -Dexec.mainClass="org.onap.policy.apex.testsuites.performance.benchmark.eventgenerator.EventGenerator" -Dexec.args="-c  src/main/resources/examples/benchmark/EventGeneratorConfig.json"
+Run Test
+--------
 
-3. Separately, create a local directory and unzip the APEX tarball
+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*.
 
 .. code-block:: bash
 
-    mkdir apex
-    cd apex
-    tar zxvf ~/git/onap/policy/apex-pdp/packages/apex-pdp-package-full/target/*gz
-    
-4. 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.
+    nohup ./jmeter.sh -n -t ~/performance.jmx -Jusers=1 -l ~/perf.log
 
-.. code-block:: bash
+Once the tests have completed, run the following the gather results.
 
-    bin/apexApps.sh engine -c ~/git/onap/policy/apex-pdp/testsuites/performance/performance-benchmark-test/src/main/resources/examples/benchmark/Javascript64.json
-5. 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)
 .. code-block:: bash
 
-    curl http://localhost:32801/EventGenerator/Stats
-    
-The results are similar to those below:
-:download:`Example APEX performance metrics <json/example-apex-perf.json>`
+    ~/jMeter/apache-jmeter-5.2.1/bin/jmeter -g perf.log -o ./performance_result/
 
 Performance Test Result
 -----------------------
 
 **Summary**
 
-Performance test was triggered for 2 hours on a 4 core, 4GB RAM virtual machine. 
+Performance test was triggered for 90 minutes. The results are shown below.
 
 **Test Statistics**
 
-:download:`Attached result log <json/result.json>`
-
-===============  =============  =================  ==============  =====================  ==================  =============  ===========
-**batchNumber**  **batchSize**  **eventsNotSent**  **eventsSent**  **eventsNotReceived**  **eventsReceived**  **Success %**  **Error %**
-===============  =============  =================  ==============  =====================  ==================  =============  ===========
-3650             182500         0                  182500          0                      182500              100 %          0 %
-===============  =============  =================  ==============  =====================  ==================  =============  ===========
-
-========================  =========================  ========================
-**averageRoundTripNano**  **shortestRoundTripNano**  **longestRoundTripNano**
-========================  =========================  ========================
-40024623                  7439158                    5161374486              
-========================  =========================  ========================
-
-============================  =============================  ============================
-**averageApexExecutionNano**  **shortestApexExecutionNano**  **longestApexExecutionNano**
-============================  =============================  ============================
-1335622                       513650                         5104326434                  
-============================  =============================  ============================
+============================ =========== ========= ==================================
+**Total Number of Requests** **Success** **Error** **Average Time Taken per Request**
+============================ =========== ========= ==================================
+9870                         100 %       0 %       5506.09 ms
+============================ =========== ========= ==================================
+
+**JMeter Screenshot**
+
+.. image:: images/apex_perf_jm_1.png
+
+.. image:: images/apex_perf_jm_2.png