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

Commit

Permalink
Add host_url,broker_port and amqp_listener_port parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
hasithajayasundara committed Jul 18, 2018
1 parent 2976c8b commit b75bb9c
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 63 deletions.
15 changes: 10 additions & 5 deletions tools/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ The tool allows developers to publish/consume messages to/from queues and topics

## Prerequisite

1. Create two queues ```micro_benchmark_queue1``` and ```micro_benchmark_queue2```.The script uses these queues separately to study the performance of queue and topic operations.

2. Copy following jars to JMETER_HOME/lib.
1. Copy following jars to JMETER_HOME/lib.

- andes-client-0.13.wso2v8.jar
- geronimo-jms_1.1_spec-1.1.0.wso2v1.jar
Expand All @@ -23,7 +21,9 @@ The tool allows developers to publish/consume messages to/from queues and topics

1. Include the following details in broker_performance_test_publisher.properties file which is located at resources/.
```properties
broker_url=<broker_url>
host_url=<host_url>
broker_port=<port_where_broker_starts>
amqp_listener_port=<port_where_amqp_listener_starts>
jmeter_home = <jmeter_home>
thread_count = <number_of_threads>
message_size = <size_of_the_message>
Expand All @@ -40,6 +40,9 @@ Upon completion of the test, you will be directed to a web interface which conta

1. Include the following details in broker_performance_test_consumer.properties file which is located at resources/.
```properties
host_url=<host_url>
broker_port=<port_where_broker_starts>
amqp_listener_port=<port_where_amqp_listener_starts>
jmeter_home = <jmeter_home>
thread_count = <number_of_threads>
number_of_messages = <number_of_messages_need_to_be_consumed>
Expand Down Expand Up @@ -78,7 +81,9 @@ number_of_messages = <number_of_messages_need_to_be_published>
- 1MB = 1MB message

- Following values are used as default values for some of the above mentioned parameters.
- broker_port = 9000
- amqp_listener_port = 5672
- thread_count = 1
- message_size = 10
- message_size = 10KB
- number_of_messages = 1000000
- throughput = 5000 (5000 messages/seconds)
25 changes: 21 additions & 4 deletions tools/scripts/broker_test_consumer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ getProperty()
}

# hash-map to store user desired parameters
declare -A user_inputs=(["jmeter_home"]="" ["broker_url"]="" ["thread_count"]="1" ["number_of_messages"]="1000000")
declare -A user_inputs=(["jmeter_home"]="" ["host_url"]="" ["broker_port"]="9000" ["amqp_listener_port"]="5672" ["thread_count"]="1" ["number_of_messages"]="1000000")

for parameter in "${!user_inputs[@]}";
do
Expand Down Expand Up @@ -119,18 +119,35 @@ then
mkdir -p target/subscriber
fi

case $queue_name in
micro_benchmark_queue1)
if [ -e resources/jndi_queue.properties ];
then
rm resources/jndi_queue.properties
fi
printf "connectionfactory.QueueConnectionFactory=amqp://admin:admin@clientID/carbon?brokerlist='tcp://${user_inputs["host_url"]}:${user_inputs["amqp_listener_port"]}'\nqueue.QueueName=micro_benchmark_queue1"
;;
micro_benchmark_queue2)
if [ -e resources/jndi_topic.properties ];
then
rm resources/jndi_queue.properties
fi
printf "connectionfactory.TopicConnectionFactory=amqp://admin:admin@clientID/carbon?brokerlist='tcp://${user_inputs["host_url"]}:${user_inputs["amqp_listener_port"]}'\ntopic.TopicName=micro_benchmark_queue2"
;;
esac

# create queues and bindings to execute tests
queue_available_response=$(curl -k -u admin:admin -o /dev/null -s -w "%{http_code}\n" ${user_inputs["broker_url"]}/broker/v1.0/queues/"$queue_name")
queue_available_response=$(curl -k -u admin:admin -o /dev/null -s -w "%{http_code}\n" https://${user_inputs["host_url"]}:${user_inputs["broker_port"]}/broker/v1.0/queues/"$queue_name")
# if queue is not available create queue
if [ "$queue_available_response" == 404 ]
then
json_payload='{"name":"'"$queue_name"'", "durable":"true","autoDelete":"true"}'
queue_create_response=$(curl -k -u admin:admin -o /dev/null -s -w "%{http_code}\n" -d "$json_payload" -H "Content-Type: application/json" -X POST ${user_inputs["broker_url"]}/broker/v1.0/queues)
queue_create_response=$(curl -k -u admin:admin -o /dev/null -s -w "%{http_code}\n" -d "$json_payload" -H "Content-Type: application/json" -X POST https://${user_inputs["host_url"]}:${user_inputs["broker_port"]}/broker/v1.0/queues)
if [ "$queue_create_response" == "201" ]
then
echo $queue_name created sucessfully.
json_payload='{"bindingPattern":"'"$queue_name"'","exchangeName":"'"$exchange_name"'","filterExpression":""}'
queue_bind_response=$(curl -k -u admin:admin -o /dev/null -s -w "%{http_code}\n" -d "$json_payload" -H "Content-Type: application/json" -X POST ${user_inputs["broker_url"]}/broker/v1.0/queues/"$queue_name"/bindings)
queue_bind_response=$(curl -k -u admin:admin -o /dev/null -s -w "%{http_code}\n" -d "$json_payload" -H "Content-Type: application/json" -X POST https://${user_inputs["host_url"]}:${user_inputs["broker_port"]}/broker/v1.0/queues/"$queue_name"/bindings)
if [ "$queue_bind_response" == "201" ]
then
echo "Binding created sucessfully with $queue_name.Exchange name - $exchange_name"
Expand Down
21 changes: 19 additions & 2 deletions tools/scripts/broker_test_publisher.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ getProperty()
}

# hash-map to store user desired parameters
declare -A user_inputs=(["jmeter_home"]="" ["broker_url"]="" ["thread_count"]="1" ["number_of_messages"]="1000000" ["throughput"]="5000" ["message_size"]="10KB")
declare -A user_inputs=(["jmeter_home"]="" ["host_url"]="" ["broker_port"]="9000" ["amqp_listener_port"]="5672" ["thread_count"]="1" ["number_of_messages"]="1000000" ["throughput"]="5000" ["message_size"]="10KB")

for parameter in "${!user_inputs[@]}";
do
Expand All @@ -100,8 +100,25 @@ do
fi
done

case $queue_name in
micro_benchmark_queue1)
if [ -e resources/jndi_queue.properties ];
then
rm resources/jndi_queue.properties
fi
printf "connectionfactory.QueueConnectionFactory=amqp://admin:admin@clientID/carbon?brokerlist='tcp://${user_inputs["host_url"]}:${user_inputs["amqp_listener_port"]}'\nqueue.QueueName=micro_benchmark_queue1" >> resources/jndi_queue.properties
;;
micro_benchmark_queue2)
if [ -e resources/jndi_topic.properties ];
then
rm resources/jndi_queue.properties
fi
printf "connectionfactory.TopicConnectionFactory=amqp://admin:admin@clientID/carbon?brokerlist='tcp://${user_inputs["host_url"]}:${user_inputs["amqp_listener_port"]}'\ntopic.TopicName=micro_benchmark_queue2" >> resources/jndi_topic.properties
;;
esac

# validate inputs
if [ ${user_inputs["broker_url"]} == '' ]
if [ ${user_inputs["host_url"]} == '' ]
then
echo "broker_url parameter in broker_test_publisher.properties cannot be empty."
exit
Expand Down
2 changes: 1 addition & 1 deletion tools/scripts/broker_test_scenario.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,6 @@ if [ $is_given_destination == false ];

# execute publisher and consumer at the same time
./broker_test_consumer.sh -d "$destination" &
sleep 2
sleep 4
./broker_test_publisher.sh -d "$destination" &
wait
8 changes: 5 additions & 3 deletions tools/scripts/resources/broker_test_consumer.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
broker_url=<broker_url>
jmeter_home=<jmeter_home>\
host_url=<host_url>
broker_port=<broker_port>
amqp_listener_port=<amqp_listener_port>
jmeter_home=<jmeter_home>
thread_count=1
number_of_messages=1000000
number_of_messages=500000
4 changes: 3 additions & 1 deletion tools/scripts/resources/broker_test_publisher.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
broker_url=<broker_url>
host_url=<host_url>
broker_port=<broker_port>
amqp_listener_port=<amqp_listener_port>
jmeter_home=<jmeter_home>
thread_count=1
number_of_messages=1000000
Expand Down
24 changes: 0 additions & 24 deletions tools/scripts/resources/jndi_queue.properties

This file was deleted.

23 changes: 0 additions & 23 deletions tools/scripts/resources/jndi_topic.properties

This file was deleted.

0 comments on commit b75bb9c

Please sign in to comment.