-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
mjaglan
committed
Dec 15, 2017
1 parent
0685847
commit 2570b9a
Showing
1 changed file
with
82 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
#!/bin/bash | ||
|
||
# debug flag on | ||
#set -x | ||
printf "\n" | ||
|
||
|
||
# Stay in KAFKA_HOME Directory | ||
cd $KAFKA_HOME | ||
|
||
|
||
# List kafka Brokers | ||
KAFKA_CONNECT=${1:-null} | ||
N=${2:-null} | ||
echo "Total $N brokers=$KAFKA_CONNECT" | ||
|
||
|
||
# Each Node Should be able to create a new topic | ||
./bin/kafka-topics.sh --create --zookeeper $HOSTNAME:2181 --replication-factor 1 --partitions 1 --topic topic-$HOSTNAME | ||
|
||
|
||
# Duplicate topics should not be created | ||
TOPIC_REP_ONE="test-topic-rep-one" | ||
RESULT=$(./bin/kafka-topics.sh --list --zookeeper $HOSTNAME:2181 | grep -i $TOPIC_REP_ONE) | ||
if [[ -z $RESULT ]] ; then | ||
./bin/kafka-topics.sh --zookeeper $HOSTNAME:2181 --create --topic $TOPIC_REP_ONE --partitions 1 --replication-factor 1 | ||
fi | ||
TOPIC_REP_N="test-topic-rep-$N" | ||
RESULT=$(./bin/kafka-topics.sh --list --zookeeper $HOSTNAME:2181 | grep -i $TOPIC_REP_N) | ||
if [[ -z $RESULT ]] ; then | ||
./bin/kafka-topics.sh --zookeeper $HOSTNAME:2181 --create --topic $TOPIC_REP_N --partitions $N --replication-factor $N | ||
fi | ||
|
||
|
||
echo "$HOSTNAME - KAFKA TOPICS:" | ||
./bin/kafka-topics.sh --list --zookeeper $HOSTNAME:2181 | ||
|
||
|
||
NUM_RECORDS=15000000 | ||
THROUGHPUT=$NUM_RECORDS | ||
MESSAGES=$NUM_RECORDS | ||
# Begin Benchmarking Apache Kafka | ||
if [[ $HOSTNAME == "testbed-1" ]] ; then | ||
echo "PRODUCER PROCESS @ $HOSTNAME -" | ||
|
||
echo "$N-thread, async $N times replication, no compression" | ||
./bin/kafka-producer-perf-test.sh --topic $TOPIC_REP_N \ | ||
--num-records $NUM_RECORDS \ | ||
--record-size 100 \ | ||
--throughput $THROUGHPUT \ | ||
--producer-props \ | ||
acks=1 \ | ||
bootstrap.servers=$KAFKA_CONNECT \ | ||
buffer.memory=67108864 \ | ||
compression.type=none \ | ||
batch.size=8196 | ||
|
||
printf "\n\n" | ||
|
||
echo "1-thread, no replication, no compression" | ||
./bin/kafka-producer-perf-test.sh --topic $TOPIC_REP_ONE \ | ||
--num-records $NUM_RECORDS \ | ||
--record-size 100 \ | ||
--throughput $THROUGHPUT \ | ||
--producer-props \ | ||
acks=1 \ | ||
bootstrap.servers=$KAFKA_CONNECT \ | ||
buffer.memory=67108864 \ | ||
compression.type=none \ | ||
batch.size=8196 | ||
|
||
else | ||
echo "CONSUMER PROCESS @ $HOSTNAME -" | ||
|
||
echo "1-thread, no replication, no compression" | ||
./bin/kafka-consumer-perf-test.sh --topic $TOPIC_REP_ONE \ | ||
--zookeeper $HOSTNAME:2181 \ | ||
--messages $MESSAGES \ | ||
--threads 1 | ||
|
||
fi | ||
|