diff options
author | Piotr Jaszczyk <piotr.jaszczyk@nokia.com> | 2019-07-05 09:00:13 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-07-05 09:00:13 +0000 |
commit | 78f6e1583cc45ed64b768b5ceaeac4f008d682e6 (patch) | |
tree | 5b6b32bf160b7851daacb4148d1140801daa3abf /tools/performance/local | |
parent | 3a4020ae3e810dad7979597feadc13d8b56b3bb1 (diff) | |
parent | cc27d520b71afc0e038bc529223dab8e8c91e678 (diff) |
Merge "Add performance test producer deployment yaml"
Diffstat (limited to 'tools/performance/local')
-rw-r--r-- | tools/performance/local/configuration/base.json | 11 | ||||
-rw-r--r-- | tools/performance/local/consul/configuration.hcl | 34 | ||||
-rw-r--r-- | tools/performance/local/docker-compose.yml | 116 | ||||
-rwxr-xr-x | tools/performance/local/local-performance-test.sh | 175 | ||||
-rw-r--r-- | tools/performance/local/logs/.gitignore | 2 | ||||
-rw-r--r-- | tools/performance/local/prometheus.yml | 14 |
6 files changed, 352 insertions, 0 deletions
diff --git a/tools/performance/local/configuration/base.json b/tools/performance/local/configuration/base.json new file mode 100644 index 00000000..2a806adb --- /dev/null +++ b/tools/performance/local/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/local/consul/configuration.hcl b/tools/performance/local/consul/configuration.hcl new file mode 100644 index 00000000..f975955e --- /dev/null +++ b/tools/performance/local/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/local/docker-compose.yml b/tools/performance/local/docker-compose.yml new file mode 100644 index 00000000..c0dfc478 --- /dev/null +++ b/tools/performance/local/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/local-performance-test.sh b/tools/performance/local/local-performance-test.sh new file mode 100755 index 00000000..3c885a64 --- /dev/null +++ b/tools/performance/local/local-performance-test.sh @@ -0,0 +1,175 @@ +#!/usr/bin/env bash + +SCRIPT_DIRECTORY="$(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 a 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 "$SCRIPT_DIRECTORY" + 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" \ + --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 "$SCRIPT_DIRECTORY" + + echo "Removing HV-VES components" + docker-compose down + exit 0 +} + +cd "$SCRIPT_DIRECTORY" + +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/local/logs/.gitignore b/tools/performance/local/logs/.gitignore new file mode 100644 index 00000000..1287e9bd --- /dev/null +++ b/tools/performance/local/logs/.gitignore @@ -0,0 +1,2 @@ +** +!.gitignore diff --git a/tools/performance/local/prometheus.yml b/tools/performance/local/prometheus.yml new file mode 100644 index 00000000..b9a937c2 --- /dev/null +++ b/tools/performance/local/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'] |