You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 15 Next »

Setting up Stability Tests in APEX

Introduction

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).

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.

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.

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

echo $(hostname -I | cut -d\  -f1) $(hostname) | sudo tee -a /etc/hosts


Make the DNS entries

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

apt-get update


Check & Install Java

apt-get install -y openjdk-8-jdk
 
java -version


Download & install JMeter

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

    echo $(hostname -I | cut -d\  -f1) $(hostname) | sudo tee -a /etc/hosts 
  2. Make the DNS entries

    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

    apt-get update
  4. Check and Install Java

    apt-get install -y openjdk-8-jdk
    java -version

    Ensure that the Java version that is executing is OpenJDK version 8

  5. Check and install docker

    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
  6. Change the permissions of the Docker socket file

    chmod 777 /var/run/docker.sock
  7. Check the status of the Docker service and ensure it is running correctly

    service docker status
    docker ps

Install apex-pdp

  1. Run the below command to create the container hosting apex-pdp by pulling the image from ONAP repository.

    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

    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.


Install & Configure VisualVM

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.


Install visualVM

sudo apt-get install visualvm


Login to docker container (using root)

docker exec -u 0 -it apex /bin/bash


Run few commands to configure permissions

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)

docker exec -it apex /bin/bash


Run following commands to start jstatd using port 1111

cd /usr/lib/jvm/java-1.8-openjdk/bin/ 


./jstatd -p 1111 -J-Djava.security.policy=visualvm.policy  &


exit


Login to VM using graphical interface in separate terminal window.

ssh -X <user>@<VM-IP-ADDRESS>


Open visualVM

visualvm &


Connect to jstatd & remote apex-pdp JVM

  1. Right click on "Remote" in the left panel of the screen and select "Add Remote Host..."
  2. Enter the IP address of apex-pdp docker container.


    docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' container_name_or_id


  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.


Sample Screenshot of visualVM

Test Plan

The 72 hours stability test will run the following steps in 20 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.


The following steps can be used to configure the parameters of 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.

    NameDescriptionDefault Value
    waitWait time after each request (in milliseconds)500
    threadsNumber of threads to run test cases in parallel.20
    threadsTimeOutInMsSynchronization timer for threads running in parallel (in milliseconds).5000

             

Download and update the jmx file presented in the apex-pdp git repository - jmx file path.

  • 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

Use the CLI mode to start the test

./jmeter.sh -n -t ~/apexPdpStabilityTestPlan.jmx -Jusers=1 -l ~/stability.log

Stability Test Result

Summary

Stability test plan was triggered for 72 hours injecting input events to apex-pdp from 20 client threads running in JMeter.

After the test stop, we can generate a HTML testreport via command

~/jMeter/apache-jmeter-5.1.1/bin/jmeter -g stability.log -o ./result/

result.zip  stability.zip  onap.zip

Number of Client Threads running in JMeter

Number of Server Threads running in Apex engine

Total number of input events

Success Percentage

Error Percentage

20 4 639460299.999971%0.0029%

Setting up Performance Tests in APEX

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. 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.

In order to run the test for 72 hours, set the batch count in the EventGeneratorConfig.json file to zero, which causes the REST server to generate batches forever.


Here is an example of how to do this:

  1. Clone and build the apex-pdp git repo
  2. Go into the performance-benchmark-test module and run the REST server

    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"
  3. Separately, create a local directory and unzip the APEX tarball

    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.

    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 file, statistics would be written into this file after event generator terminated)

    curl http://localhost:32801/EventGenerator/Stats

The results are similar to those below:

Example APEX performance metrics
 {
  "totalStats": {
    "batchNumber": -1,
    "batchSize": 1000,
    "apexClient": "TOTAL",
    "eventsNotSent": 0,
    "eventsSent": 1000,
    "eventsNotReceived": 0,
    "eventsReceived": 1000,
    "averageRoundTripNano": 159434725,
    "shortestRoundTripNano": 23059921,
    "longestRoundTripNano": 1106994552,
    "averageApexExecutionNano": 26780360,
    "shortestApexExecutionNano": 1066002,
    "longestApexExecutionNano": 323934929
  },
  "batchStatsList": [
    {
      "batchNumber": 0,
      "batchSize": 50,
      "apexClient": "localhost(127.0.0.1):38428",
      "eventsNotSent": 0,
      "eventsSent": 50,
      "eventsNotReceived": 0,
      "eventsReceived": 50,
      "averageRoundTripNano": 995018520,
      "shortestRoundTripNano": 835971769,
      "longestRoundTripNano": 1106994552,
      "averageApexExecutionNano": 241706832,
      "shortestApexExecutionNano": 73723978,
      "longestApexExecutionNano": 323934929
    },
    {
      "batchNumber": 1,
      "batchSize": 50,
      "apexClient": "localhost(127.0.0.1):38428",
      "eventsNotSent": 0,
      "eventsSent": 50,
      "eventsNotReceived": 0,
      "eventsReceived": 50,
      "averageRoundTripNano": 204429789,
      "shortestRoundTripNano": 56234319,
      "longestRoundTripNano": 305690768,
      "averageApexExecutionNano": 89544892,
      "shortestApexExecutionNano": 7785682,
      "longestApexExecutionNano": 177171848
    },
    {
      "batchNumber": 2,
      "batchSize": 50,
      "apexClient": "localhost(127.0.0.1):38430",
      "eventsNotSent": 0,
      "eventsSent": 50,
      "eventsNotReceived": 0,
      "eventsReceived": 50,
      "averageRoundTripNano": 160524927,
      "shortestRoundTripNano": 41179914,
      "longestRoundTripNano": 266809149,
      "averageApexExecutionNano": 68178648,
      "shortestApexExecutionNano": 2784005,
      "longestApexExecutionNano": 160119899
    },
    {
      "batchNumber": 3,
      "batchSize": 50,
      "apexClient": "localhost(127.0.0.1):38428",
      "eventsNotSent": 0,
      "eventsSent": 50,
      "eventsNotReceived": 0,
      "eventsReceived": 50,
      "averageRoundTripNano": 123442425,
      "shortestRoundTripNano": 32320688,
      "longestRoundTripNano": 204549694,
      "averageApexExecutionNano": 35810567,
      "shortestApexExecutionNano": 2325630,
      "longestApexExecutionNano": 102168076
    },
    {
      "batchNumber": 4,
      "batchSize": 50,
      "apexClient": "localhost(127.0.0.1):38430",
      "eventsNotSent": 0,
      "eventsSent": 50,
      "eventsNotReceived": 0,
      "eventsReceived": 50,
      "averageRoundTripNano": 134903088,
      "shortestRoundTripNano": 61195662,
      "longestRoundTripNano": 205959446,
      "averageApexExecutionNano": 17987078,
      "shortestApexExecutionNano": 2243213,
      "longestApexExecutionNano": 39218327
    },
    {
      "batchNumber": 5,
      "batchSize": 50,
      "apexClient": "localhost(127.0.0.1):38428",
      "eventsNotSent": 0,
      "eventsSent": 50,
      "eventsNotReceived": 0,
      "eventsReceived": 50,
      "averageRoundTripNano": 115759297,
      "shortestRoundTripNano": 46415800,
      "longestRoundTripNano": 180262438,
      "averageApexExecutionNano": 12719990,
      "shortestApexExecutionNano": 1868046,
      "longestApexExecutionNano": 32387313
    },
    {
      "batchNumber": 6,
      "batchSize": 50,
      "apexClient": "localhost(127.0.0.1):38430",
      "eventsNotSent": 0,
      "eventsSent": 50,
      "eventsNotReceived": 0,
      "eventsReceived": 50,
      "averageRoundTripNano": 130974073,
      "shortestRoundTripNano": 60415786,
      "longestRoundTripNano": 191390626,
      "averageApexExecutionNano": 7577036,
      "shortestApexExecutionNano": 1888337,
      "longestApexExecutionNano": 21813501
    },
    {
      "batchNumber": 7,
      "batchSize": 50,
      "apexClient": "localhost(127.0.0.1):38428",
      "eventsNotSent": 0,
      "eventsSent": 50,
      "eventsNotReceived": 0,
      "eventsReceived": 50,
      "averageRoundTripNano": 115724681,
      "shortestRoundTripNano": 23059921,
      "longestRoundTripNano": 170915878,
      "averageApexExecutionNano": 14406756,
      "shortestApexExecutionNano": 1402961,
      "longestApexExecutionNano": 57016237
    },
    {
      "batchNumber": 8,
      "batchSize": 50,
      "apexClient": "localhost(127.0.0.1):38430",
      "eventsNotSent": 0,
      "eventsSent": 50,
      "eventsNotReceived": 0,
      "eventsReceived": 50,
      "averageRoundTripNano": 87268333,
      "shortestRoundTripNano": 29857934,
      "longestRoundTripNano": 142114113,
      "averageApexExecutionNano": 8295938,
      "shortestApexExecutionNano": 1292335,
      "longestApexExecutionNano": 22250460
    },
    {
      "batchNumber": 9,
      "batchSize": 50,
      "apexClient": "localhost(127.0.0.1):38430",
      "eventsNotSent": 0,
      "eventsSent": 50,
      "eventsNotReceived": 0,
      "eventsReceived": 50,
      "averageRoundTripNano": 89515572,
      "shortestRoundTripNano": 27979472,
      "longestRoundTripNano": 151246340,
      "averageApexExecutionNano": 2988598,
      "shortestApexExecutionNano": 1251419,
      "longestApexExecutionNano": 10779438
    },
    {
      "batchNumber": 10,
      "batchSize": 50,
      "apexClient": "localhost(127.0.0.1):38428",
      "eventsNotSent": 0,
      "eventsSent": 50,
      "eventsNotReceived": 0,
      "eventsReceived": 50,
      "averageRoundTripNano": 161559717,
      "shortestRoundTripNano": 54052523,
      "longestRoundTripNano": 220095891,
      "averageApexExecutionNano": 2439668,
      "shortestApexExecutionNano": 1413877,
      "longestApexExecutionNano": 7713140
    },
    {
      "batchNumber": 11,
      "batchSize": 50,
      "apexClient": "localhost(127.0.0.1):38428",
      "eventsNotSent": 0,
      "eventsSent": 50,
      "eventsNotReceived": 0,
      "eventsReceived": 50,
      "averageRoundTripNano": 102126750,
      "shortestRoundTripNano": 43249960,
      "longestRoundTripNano": 147393457,
      "averageApexExecutionNano": 4201824,
      "shortestApexExecutionNano": 1343794,
      "longestApexExecutionNano": 20132831
    },
    {
      "batchNumber": 12,
      "batchSize": 50,
      "apexClient": "localhost(127.0.0.1):38432",
      "eventsNotSent": 0,
      "eventsSent": 50,
      "eventsNotReceived": 0,
      "eventsReceived": 50,
      "averageRoundTripNano": 94621079,
      "shortestRoundTripNano": 44447504,
      "longestRoundTripNano": 136784978,
      "averageApexExecutionNano": 2053586,
      "shortestApexExecutionNano": 1314753,
      "longestApexExecutionNano": 4677176
    },
    {
      "batchNumber": 13,
      "batchSize": 50,
      "apexClient": "localhost(127.0.0.1):38432",
      "eventsNotSent": 0,
      "eventsSent": 50,
      "eventsNotReceived": 0,
      "eventsReceived": 50,
      "averageRoundTripNano": 95569040,
      "shortestRoundTripNano": 45539798,
      "longestRoundTripNano": 131660842,
      "averageApexExecutionNano": 3325890,
      "shortestApexExecutionNano": 1711712,
      "longestApexExecutionNano": 14248153
    },
    {
      "batchNumber": 14,
      "batchSize": 50,
      "apexClient": "localhost(127.0.0.1):38432",
      "eventsNotSent": 0,
      "eventsSent": 50,
      "eventsNotReceived": 0,
      "eventsReceived": 50,
      "averageRoundTripNano": 118841955,
      "shortestRoundTripNano": 41387040,
      "longestRoundTripNano": 164058281,
      "averageApexExecutionNano": 8456753,
      "shortestApexExecutionNano": 1066002,
      "longestApexExecutionNano": 40687580
    },
    {
      "batchNumber": 15,
      "batchSize": 50,
      "apexClient": "localhost(127.0.0.1):38432",
      "eventsNotSent": 0,
      "eventsSent": 50,
      "eventsNotReceived": 0,
      "eventsReceived": 50,
      "averageRoundTripNano": 98047224,
      "shortestRoundTripNano": 53382064,
      "longestRoundTripNano": 137689355,
      "averageApexExecutionNano": 3103221,
      "shortestApexExecutionNano": 1642711,
      "longestApexExecutionNano": 13629027
    },
    {
      "batchNumber": 16,
      "batchSize": 50,
      "apexClient": "localhost(127.0.0.1):38432",
      "eventsNotSent": 0,
      "eventsSent": 50,
      "eventsNotReceived": 0,
      "eventsReceived": 50,
      "averageRoundTripNano": 89551458,
      "shortestRoundTripNano": 43607586,
      "longestRoundTripNano": 125304371,
      "averageApexExecutionNano": 4844014,
      "shortestApexExecutionNano": 1753670,
      "longestApexExecutionNano": 18681287
    },
    {
      "batchNumber": 17,
      "batchSize": 50,
      "apexClient": "localhost(127.0.0.1):38432",
      "eventsNotSent": 0,
      "eventsSent": 50,
      "eventsNotReceived": 0,
      "eventsReceived": 50,
      "averageRoundTripNano": 98811396,
      "shortestRoundTripNano": 41244373,
      "longestRoundTripNano": 141306528,
      "averageApexExecutionNano": 2908269,
      "shortestApexExecutionNano": 1398919,
      "longestApexExecutionNano": 10733647
    },
    {
      "batchNumber": 18,
      "batchSize": 50,
      "apexClient": "localhost(127.0.0.1):38450",
      "eventsNotSent": 0,
      "eventsSent": 50,
      "eventsNotReceived": 0,
      "eventsReceived": 50,
      "averageRoundTripNano": 85947612,
      "shortestRoundTripNano": 40228871,
      "longestRoundTripNano": 124690954,
      "averageApexExecutionNano": 2324032,
      "shortestApexExecutionNano": 1478128,
      "longestApexExecutionNano": 5606719
    },
    {
      "batchNumber": 19,
      "batchSize": 50,
      "apexClient": "localhost(127.0.0.1):38432",
      "eventsNotSent": 0,
      "eventsSent": 50,
      "eventsNotReceived": 0,
      "eventsReceived": 50,
      "averageRoundTripNano": 86057583,
      "shortestRoundTripNano": 45376757,
      "longestRoundTripNano": 119651361,
      "averageApexExecutionNano": 2733608,
      "shortestApexExecutionNano": 1704628,
      "longestApexExecutionNano": 12086274
    }
  ]
}

Performance Test Result

Summary

Performance test was triggered for 2 hours on a 4 core, 4GB RAM virtual machine. 

Test Statistics

Attached result log.


batchNumberbatchSizeeventsNotSenteventsSenteventsNotReceivedeventsReceivedaverageRoundTripNanoshortestRoundTripNanolongestRoundTripNanoaverageApexExecutionNanoshortestApexExecutionNanolongestApexExecutionNanoSuccess Percentage

Error Percentage

365018250001825000182500400246237439158516137448613356225136505104326434100%0%
  • No labels