aboutsummaryrefslogtreecommitdiffstats
path: root/tools/performance
diff options
context:
space:
mode:
authorJakub Dudycz <jakub.dudycz@nokia.com>2019-06-21 17:19:49 +0200
committerJakub Dudycz <jakub.dudycz@nokia.com>2019-07-03 11:49:14 +0200
commit83a1d39bca162e8fdabfb3ad9189c5e4f94a44df (patch)
treec0ee3c382cb9072c0fdd21f46649ada824852c5c /tools/performance
parent3449b38b23fe1952a534ab35c5a23105c13e8262 (diff)
Create script to run performance test locally
Change-Id: I6bbf0e9b029aef1558008286f0fbec83b76be44c Signed-off-by: Jakub Dudycz <jakub.dudycz@nokia.com> Issue-ID: DCAEGEN2-1641
Diffstat (limited to 'tools/performance')
-rw-r--r--tools/performance/configuration/base.json11
-rw-r--r--tools/performance/consul/configuration.hcl34
-rw-r--r--tools/performance/docker-compose.yml116
-rwxr-xr-xtools/performance/local-performance-test.sh176
-rw-r--r--tools/performance/logs/.gitignore2
-rw-r--r--tools/performance/prometheus.yml14
6 files changed, 353 insertions, 0 deletions
diff --git a/tools/performance/configuration/base.json b/tools/performance/configuration/base.json
new file mode 100644
index 00000000..2a806adb
--- /dev/null
+++ b/tools/performance/configuration/base.json
@@ -0,0 +1,11 @@
+{
+ "logLevel": "DEBUG",
+ "server.listenPort": 6061,
+ "server.idleTimeoutSec": 60,
+ "cbs.firstRequestDelaySec": 5,
+ "cbs.requestIntervalSec": 5,
+ "security.keys.keyStoreFile": "/etc/ves-hv/ssl/server.p12",
+ "security.keys.keyStorePasswordFile": "/etc/ves-hv/ssl/server.pass",
+ "security.keys.trustStoreFile": "/etc/ves-hv/ssl/trust.p12",
+ "security.keys.trustStorePasswordFile": "/etc/ves-hv/ssl/trust.pass"
+} \ No newline at end of file
diff --git a/tools/performance/consul/configuration.hcl b/tools/performance/consul/configuration.hcl
new file mode 100644
index 00000000..f975955e
--- /dev/null
+++ b/tools/performance/consul/configuration.hcl
@@ -0,0 +1,34 @@
+/*
+ * ============LICENSE_START=======================================================
+ * csit-dcaegen2-collectors-hv-ves
+ * ================================================================================
+ * Copyright (C) 2019 NOKIA
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+server = true
+bootstrap = true
+ui = true
+client_addr = "0.0.0.0"
+
+service {
+ # name under which hv-ves collector should seek cbs
+ # usually set as CONFIG_BINDING_SERVICE environment variable
+ Name = "CBS"
+ # address of CBS as seen by hv-ves collector
+ Address = "config-binding-service"
+ Port = 10000
+}
+
diff --git a/tools/performance/docker-compose.yml b/tools/performance/docker-compose.yml
new file mode 100644
index 00000000..82143235
--- /dev/null
+++ b/tools/performance/docker-compose.yml
@@ -0,0 +1,116 @@
+version: "3.5"
+services:
+
+ message-router-zookeeper:
+ image: nexus3.onap.org:10001/onap/dmaap/zookeeper:4.0.0
+ ports:
+ - "2181:2181"
+
+ message-router-kafka-0:
+ image: nexus3.onap.org:10001/onap/dmaap/kafka111:0.0.6
+ ports:
+ - "9092:9092"
+ - "9093:9093"
+ environment:
+ HOST_IP: 127.0.0.1
+ KAFKA_BROKER_ID: 0
+ ENDPOINT_PORT: 30490
+ KAFKA_ZOOKEEPER_CONNECT: "message-router-zookeeper:2181"
+ KAFKA_AUTO_CREATE_TOPICS_ENABLE: "true"
+ KAFKA_DELETE_TOPIC_ENABLE: "true"
+
+ KAFKA_LISTENERS: "INTERNAL_SASL_PLAINTEXT://0.0.0.0:9092,EXTERNAL_SASL_PLAINTEXT://0.0.0.0:9093"
+ KAFKA_ADVERTISED_LISTENERS: "INTERNAL_SASL_PLAINTEXT://message-router-kafka-0:9092,EXTERNAL_SASL_PLAINTEXT://message-router-kafka-0:9093"
+ KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: "INTERNAL_SASL_PLAINTEXT:SASL_PLAINTEXT,EXTERNAL_SASL_PLAINTEXT:SASL_PLAINTEXT"
+ KAFKA_INTER_BROKER_LISTENER_NAME: "INTERNAL_SASL_PLAINTEXT"
+ KAFKA_SASL_ENABLED_MECHANISMS: "PLAIN"
+ KAFKA_SASL_MECHANISM_INTER_BROKER_PROTOCOL: "PLAIN"
+ KAFKA_AUTHORIZER_CLASS_NAME: "org.onap.dmaap.kafkaAuthorize.KafkaCustomAuthorizer"
+
+ aaf_locate_url: https://aaf-locate:8095
+ KAFKA_LOG_DIRS: /opt/kafka/data
+ KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
+ KAFKA_DEFAULT_REPLICATION_FACTOR: 1
+ KAFKA_NUM_PARTITIONS: 1
+ volumes:
+ - /var/run/docker.sock:/var/run/docker.sock
+ depends_on:
+ - message-router-zookeeper
+
+ consul-server:
+ image: docker.io/consul:1.0.6
+ ports:
+ - "8500:8500"
+ volumes:
+ - ./consul/:/consul/config
+
+ consul-bootstrap:
+ image: docker.io/consul:1.0.6
+ restart: on-failure
+ command: ["kv", "put", "-http-addr=http://consul-server:8500", "dcae-hv-ves-collector", '{
+ "streams_publishes": {
+ "perf3gpp": {
+ "type": "kafka",
+ "aaf_credentials": {
+ "username": "admin",
+ "password": "admin_secret"
+ },
+ "kafka_info": {
+ "bootstrap_servers": "message-router-kafka-0:9093",
+ "topic_name": "HV_VES_PERF3GPP"
+ }
+ }
+ }
+ }'
+ ]
+ depends_on:
+ - consul-server
+
+ config-binding-service:
+ image: nexus3.onap.org:10001/onap/org.onap.dcaegen2.platform.configbinding.app-app:2.2.4
+ ports:
+ - "10000:10000"
+ environment:
+ CONSUL_HOST: "consul-server"
+ depends_on:
+ - consul-bootstrap
+
+ ves-hv-collector:
+ image: onap/org.onap.dcaegen2.collectors.hv-ves.hv-collector-main:latest
+ ports:
+ - "6060:6060"
+ - "6061:6061/tcp"
+ environment:
+ JAVA_OPTS: "-Dio.netty.leakDetection.level=paranoid -Dlogback.configurationFile=/etc/ONAP/dcae-hv-ves-collector/logback.xml"
+ VESHV_CONFIGURATION_FILE: "/etc/ves-hv/configuration/base.json"
+ CONSUL_HOST: "consul-server"
+ CONFIG_BINDING_SERVICE: "CBS"
+ HOSTNAME: "dcae-hv-ves-collector"
+ healthcheck:
+ test: ./healthcheck.sh || exit 1
+ interval: 10s
+ timeout: 3s
+ retries: 3
+ start_period: 15s
+ depends_on:
+ - message-router-kafka-0
+ - config-binding-service
+ volumes:
+ - ./configuration/:/etc/ves-hv/configuration/
+ - ./logs:/var/log/ONAP/dcae-hv-ves-collector
+ - ../ssl/:/etc/ves-hv/ssl/
+
+ kafka-consumer:
+ image: onap/org.onap.dcaegen2.collectors.hv-ves.hv-collector-kafka-consumer
+ ports:
+ - "6064:6064/tcp"
+ command: ["--listen-port", "6062"]
+ depends_on:
+ - message-router-kafka-0
+
+ prometheus:
+ image: prom/prometheus
+ ports:
+ - "9090:9090"
+ volumes:
+ - ./prometheus.yml:/etc/prometheus/prometheus.yml
diff --git a/tools/performance/local-performance-test.sh b/tools/performance/local-performance-test.sh
new file mode 100755
index 00000000..cad21ef8
--- /dev/null
+++ b/tools/performance/local-performance-test.sh
@@ -0,0 +1,176 @@
+#!/usr/bin/env bash
+
+cd "$(dirname "$0")"
+
+CERT_FILE=${CERT_FILE:-/ssl/client.p12}
+CERT_PASS_FILE=${CERT_PASS_FILE:-/ssl/client.pass}
+HV_VES_NETWORK=${HV_VES_NETWORK:-performance_default}
+VOLUME_MAPPING=${VOLUME_MAPPING:-$PWD/../ssl/:/ssl}
+PRODUCER_IMAGE_NAME=${PRODUCER_IMAGE_NAME:-the-a-team-registry-local.esisoj70.emea.nsn-net.net/onap/org.onap.dcaegen2.collectors.hv-ves.hv-collector-rust-client:latest}
+
+PRODUCER_APP_NAME=hv-ves-producer
+HV_VES_ADDRESS=ves-hv-collector:6061
+CONTAINERS_COUNT=1
+CLIENTS_PER_CONTAINER=1
+MSG_SIZE=16384
+MSG_COUNT=1000
+INTERVAL_MS=0
+
+
+function usage() {
+ echo ""
+ echo "Run HV-VES performance test locally"
+ echo "Usage $0 setup|start|clean|help"
+ echo " setup : generate certs and set up docker components"
+ echo " start : run the performance test"
+ echo " Optional parameters:"
+ echo " --address : HV-VES address in host:port format (ves-hv-collector:6061)"
+ echo " --containers : number of docker containers to create (1)"
+ echo " --clients : number of clients in single container (1)"
+ echo " --msg-size : size in bytes of a single message (16384)"
+ echo " --msg-count : amount of messages to sent by one client in single container (1000)"
+ echo " --interval : interval between messages (0)"
+ echo " clean : remove generated certs, HV-VES components and producers"
+ echo " help : print usage"
+ echo "Example invocations:"
+ echo "./local-performance-test.sh setup"
+ echo "./local-performance-test.sh start --containers 10 --clients 100 --msg-count 10000"
+ echo "./local-performance-test.sh clean"
+ exit 1
+}
+
+function setup_environment(){
+ echo "Setting up"
+ cd ../ssl
+ ./gen-certs.sh
+ cd ../performance
+ docker-compose up -d
+
+ echo "Waiting for components to be healthy.."
+ while [[ $(docker-compose ps | grep -c "unhealthy\|starting") -ne 0 ]] ; do
+ sleep 1
+ done
+
+ echo "All components ready"
+ exit 0
+}
+
+function start_performance_test(){
+
+ TEST_ID=$(date +%s)
+ create_containers ${CONTAINERS_COUNT} ${TEST_ID} &
+
+ while :; do
+ ACTIVE_PRODUCERS=$(docker ps --format "table {{.ID}}\t{{.Status}}" -f "label=id=$TEST_ID")
+ ACTIVE_PRODUCERS_COUNT=$(echo "$ACTIVE_PRODUCERS" | grep -c "Up")
+
+ clear
+ print_test_configuration
+ echo "Active producers ($ACTIVE_PRODUCERS_COUNT/$CONTAINERS_COUNT):"
+ echo "$ACTIVE_PRODUCERS"
+
+ EXITED_CONTAINERS=$(docker ps -aq -f "label=id=$TEST_ID" -f status=exited | wc -l)
+ [[ ${EXITED_CONTAINERS} -eq ${CONTAINERS_COUNT} ]] && break
+
+ sleep 1
+ done
+
+ clear
+ print_test_configuration
+ echo "Test finished"
+ # TODO put test result here
+ exit 0
+}
+
+function print_test_configuration(){
+ echo "PERFORMANCE TEST IN PROGRESS"
+ echo ""
+ echo "Test configuration:"
+ echo "Containers count: $CONTAINERS_COUNT"
+ echo "Clients per container: $CLIENTS_PER_CONTAINER"
+ echo "Message size: $MSG_SIZE"
+ echo "Messages per client: $MSG_COUNT"
+ echo "Interval: $INTERVAL_MS"
+ echo ""
+}
+
+function create_containers(){
+
+ for i in $(seq 1 ${1}); do
+ docker run -d -l id="$2" -l app="$PRODUCER_APP_NAME" -v "$VOLUME_MAPPING" --network="$HV_VES_NETWORK" "$PRODUCER_IMAGE_NAME" \
+ --address "$HV_VES_ADDRESS" \
+ --certfile "$CERT_FILE" \
+ --certpass "$CERT_PASS_FILE" \
+ --containers "$CONTAINERS_COUNT" \
+ --clients "$CLIENTS_PER_CONTAINER" \
+ --msgsize "$MSG_SIZE" \
+ --msgcount "$MSG_COUNT" \
+ --intervalms "$INTERVAL_MS" > /dev/null
+ done
+}
+
+function clean(){
+ echo "Cleaning up"
+
+ echo "Removing active producers"
+ docker rm --force $(docker ps -aqf "label=app=$PRODUCER_APP_NAME")
+
+ echo "Clearing generated certs"
+ cd ../ssl
+ ./gen-certs.sh clean
+ cd ../performance
+
+ echo "Removing HV-VES components"
+ docker-compose down
+ exit 0
+}
+
+if [[ $# -eq 0 ]]; then
+ usage
+else
+ for arg in ${@}
+ do
+ case ${arg} in
+ setup)
+ setup_environment
+ ;;
+ start)
+ shift 1
+ while [[ $(($#)) -gt 0 ]]; do
+ case "${1}" in
+ --address)
+ HV_VES_ADDRESS=${2}
+ ;;
+ --containers)
+ CONTAINERS_COUNT=${2}
+ ;;
+ --clients)
+ CLIENTS_PER_CONTAINER=${2}
+ ;;
+ --msg-size)
+ MSG_SIZE=${2}
+ ;;
+ --msg-count)
+ MSG_COUNT=${2}
+ ;;
+ --interval)
+ INTERVAL_MS=${2}
+ ;;
+ esac
+ shift 2
+ done
+ start_performance_test
+ ;;
+ clean)
+ clean
+ ;;
+ help)
+ usage
+ ;;
+ *)
+ echo "Unknown action: ${arg}" >&2
+ usage
+ ;;
+ esac
+ done
+fi \ No newline at end of file
diff --git a/tools/performance/logs/.gitignore b/tools/performance/logs/.gitignore
new file mode 100644
index 00000000..1287e9bd
--- /dev/null
+++ b/tools/performance/logs/.gitignore
@@ -0,0 +1,2 @@
+**
+!.gitignore
diff --git a/tools/performance/prometheus.yml b/tools/performance/prometheus.yml
new file mode 100644
index 00000000..b9a937c2
--- /dev/null
+++ b/tools/performance/prometheus.yml
@@ -0,0 +1,14 @@
+global:
+ scrape_interval: 5s
+ external_labels:
+ monitor: 'my-monitor'
+
+scrape_configs:
+ - job_name: 'prometheus'
+ static_configs:
+ - targets: ['localhost:9090']
+
+ - job_name: 'kafka-consumer'
+ metrics_path: '/monitoring/prometheus'
+ static_configs:
+ - targets: ['kafka-consumer:6062']