blob: c71fc0c21fa8946753169ed06920174e4011216b [file] [log] [blame]
#!/bin/sh
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF 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.
#
# This starts the controller for coordinating perf tests/
. check-qpid-java-env
PROGRAM_NAME="start-consumers"
PROCESS_COUNT=1
CON_COUNT=1
MSG_COUNT=10000
ADDRESS="queue;{create:always}"
UNIQUE_DEST="false"
EXTRA_JVM_ARGS=" -Dmax_prefetch=500 "
TEST_ID=`echo ${HOSTNAME} | awk -F . '{print $1}'`
TEMP=$(getopt -n $PROGRAM_NAME -o C:P:uc:p:a:s:t:w:h\
--long connection-count:,process-count:,create-unique-queues-topics,\
jvm-args:,queue:,topic:,address:,\
msg-count:,help -- "$@")
usage()
{
printf "\n%s\n" "Usage: start-producers [option].."
printf "\n%32s\n%51s\n" "-C, --connection-count=count" "No of consumers participating in the test"
printf "\n%29s\n%51s\n" "-P, --process-count=count" "No of producers participating in the test"
printf "\n%37s\n%105s\n" "-u, --create-unique-queues-topics" "This will create unique queue names and topics based on what you specify for --queue or --topic"
printf "\n%11s\n%55s\n" "--queue" "The Queue you want to publish to. Ex my-queue"
printf "\n%11s\n%84s\n" "--topic" "The Topic you want to publish to in amq.topic exchange. Ex amq.topic/topic"
printf "\n%13s\n%44s\n" "--address" "The address you want to publish to"
printf "\n%25s\n%50s\n" "-c, --msg-count=count" "message count per test (default 500,000)"
printf "\n%18s\n%49s\n" "-a, --jvm-args" "Extra jvm arguments you want to specify"
}
eval set -- "$TEMP"
while true; do
case $1 in
-C|--connection-count)
CON_COUNT="$2"; shift; shift; continue
;;
-P|--process-count)
PROCESS_COUNT="$2"; shift; shift; continue
;;
-u|--create-unique-queues-topics)
UNIQUE_DEST="true"; shift; continue
;;
--queue)
ADDRESS="$2;{create: always}"; shift; shift; continue
;;
--topic)
ADDRESS="amq.topic/$2"; shift; shift; continue
;;
--address)
ADDRESS="$2"; shift; shift; continue
;;
-h|--help)
usage
exit 0
;;
-a|--jvm-args)
EXTRA_JVM_ARGS="$2"; shift; shift; continue
;;
-c|--msg-count)
MSG_COUNT="$2"; shift; shift; continue
;;
--)
# no more arguments to parse
break
;;
*)
# no more arguments to parse
break
;;
esac
done
CONSUMER_ARGS="-server -Durl=amqp://guest:guest@clientid/testpath?brokerlist='tcp://localhost:5672' -Dprecision=mili -Dcon_count=$CON_COUNT -Dprint_std_dev=true"
start_consumers()
{
for ((i=0; i<$PROCESS_COUNT; i++))
do
if [ "$UNIQUE_DEST" = "true" ]; then
sh run-sub "$CONSUMER_ARGS $@" "${TEST_ID}_$i" > ${TEST_ID}_$i.sub.out 2>&1 &
else
sh run-sub "$CONSUMER_ARGS $@" > ${TEST_ID}_$i.sub.out 2>&1 &
fi
done
}
start_consumers "-Daddress=$ADDRESS -Duse_unique_dest=$UNIQUE_DEST -Dmsg_count=$MSG_COUNT -Dcon_count=$CON_COUNT $EXTRA_JVM_ARGS"