Skip to content
This repository has been archived by the owner on Oct 5, 2021. It is now read-only.

Commit

Permalink
Merge pull request #510 from hasithajayasundara/master
Browse files Browse the repository at this point in the history
Added 40KB message size test case
  • Loading branch information
sdkottegoda authored Aug 9, 2018
2 parents 2fe69da + 6b916c9 commit ac85b94
Show file tree
Hide file tree
Showing 5 changed files with 1,786 additions and 2 deletions.
5 changes: 5 additions & 0 deletions tools/scripts/resources/40KB_test_plan.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
JmeterHome=<jmeter_home>
ThreadCount=10
MessageSize=40KB
NumberOfMessages=1000000
Throughput=5000
5 changes: 5 additions & 0 deletions tools/scripts/resources/broker_test_plan.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
JmeterHome = <jmeter_home>
ThreadCount = <number_of_threads>
MessageSize = <size_of_the_message>
NumberOfMessages = <number_of_messages_need_to_be_published>
Throughput= <throughput_need_to_be_maintained>
79 changes: 79 additions & 0 deletions tools/scripts/run_40KB_test_scenario.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Copyright (c) 2018, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.

# WSO2 Inc. licenses this file to you 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.

#!/usr/bin/env bash

destination=""
is_given_destination=false

# get inputs from the user -d topic/queue
while getopts "hp:d:t:h:v" OPTION
do
case $OPTION in
d)
case $OPTARG in
queue)
is_given_destination=true
destination="queue"
;;
topic)
is_given_destination=true
destination="topic"
;;
?)
echo $OPTARG
echo "$OPTARG is an invalid destination.JMS destination should be a queue or a topic"
exit
;;
esac
break
;;
h)
help_text="Welcome to ballerina message broker micro-benchmark tool\n\nUsage:\n\t./run_40KB_test_scenario.sh [command].\n\nCommands\n\t-h ask for help\n\t-d set jms destination type queue/topic\n"
printf "$help_text"
exit
;;
?)
printf "Invalid command.Run ./run_broker_test_scenario.sh -h for usage.\n"
exit
;;
esac
done


if [ $is_given_destination == false ];
then
printf 'A JMS destination should be provided.\nRun ./run_40KB_test_scenario.sh -h for usage.\n'
exit
fi

time=$(date '+%d-%m-%Y-%H-%M-%S')
broker_consumer_log=broker_consumer_"$time".log
broker_publisher_log=broker_publisher_"$time".log

# create log folder if not exist
if [ ! -e logs ];
then
mkdir -p logs
fi

# execute publisher and consumer at the same time
echo "Starting message consumer."
printf $(run_broker_consumer.sh -t "resources/40KB_test_plan.properties" -s "40KB_test_scenario/$time" -d "queue" &) >> logs/"$broker_consumer_log"
sleep 4
echo "Starting message pubisher"
printf $(run_broker_publisher.sh -t "resources/40KB_test_plan.properties" -s "40KB_test_scenario/$time" -d "queue" & >> logs/"$broker_publisher_log")
wait
7 changes: 5 additions & 2 deletions tools/scripts/run_broker_publisher.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ do
esac
done

if [ $is_given_destination == false ];
if [ $is_given_destination == false ]
then
printf 'A JMS destination should be provided.\nRun ./run_broker_publisher.sh -h for usage.\n'
exit
Expand Down Expand Up @@ -200,14 +200,17 @@ case ${testplan_user_inputs["MessageSize"]} in
10KB)
text_message_file_location="sample_messages/10kB.json"
;;
40KB)
text_message_file_location="sample_messages/40kB.json"
;;
100KB)
text_message_file_location="sample_messages/100kB.json"
;;
1MB)
text_message_file_location="sample_messages/1MB.json"
;;
?)
echo message_size parameter should be one of 1KB,10KB,100KB and 1MB
echo message_size parameter should be one of 1KB, 10KB, 40KB, 100KB and 1MB
exit
;;
esac
Expand Down
Loading

0 comments on commit ac85b94

Please sign in to comment.