Skip to content

Commit

Permalink
Providing Scripts for Cassandra's Warmup and Test (#398)
Browse files Browse the repository at this point in the history
* New script for loading and warming up the server

* Make parameters alternative.
  • Loading branch information
xusine authored Feb 7, 2023
1 parent 330dc34 commit b824308
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 45 deletions.
11 changes: 6 additions & 5 deletions benchmarks/data-serving/client/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ENV YCSB_VERSION 0.14.0

RUN set -ex \
&& apt-get update \
&& apt-get install -y wget \
&& apt-get install -y wget vim \
&& wget -q --show-progress --progress=bar:force -O /tmp/cassandra-tools_${CASSANDRA_VERSION}_all.deb http://archive.apache.org/dist/cassandra/${CASSANDRA_VERSION}/debian/cassandra-tools_${CASSANDRA_VERSION}_all.deb \
&& dpkg --force-depends -i /tmp/cassandra-tools_${CASSANDRA_VERSION}_all.deb \
&& rm -rf /tmp/cassandra-tools_${CASSANDRA_VERSION}_all.deb
Expand All @@ -16,9 +16,10 @@ RUN wget -q --show-progress --progress=bar:force https://github.com/brianfrankco
&& chown cassandra:cassandra -R /ycsb/workloads

COPY setup_tables.txt /setup_tables.txt
COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh

ENTRYPOINT ["/docker-entrypoint.sh"]
COPY warmup.sh /warmup.sh
COPY load.sh /load.sh
RUN chmod +x /load.sh /warmup.sh
RUN chown cassandra:cassandra /load.sh /warmup.sh

USER cassandra

40 changes: 0 additions & 40 deletions benchmarks/data-serving/client/docker-entrypoint.sh

This file was deleted.

31 changes: 31 additions & 0 deletions benchmarks/data-serving/client/load.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

# Usage: load.sh <server_ip> <record_count> <target_load> <threads=1> <operation_count=load * 60>

if [ -z $4 ]; then
THREADS=1
else
THREADS=$4
fi

if [ -z $5 ]; then
let OP_COUNT="60*$3"
else
OP_COUNT=$5
fi


echo '======================================================'
echo "server IP: $1"
echo "Database record count: $2"
echo "Target load: $3 rps"
echo "Loader threads count: $THREADS"
echo "Opeartion count: $OP_COUNT"
echo "Make sure you have run the warmup.sh before loading the server, and use the same record count here."
echo '======================================================'

/ycsb/bin/ycsb run cassandra-cql -p hosts=$1 -P /ycsb/workloads/workloada \
-p recordcount=$2 -p operationcount=$OP_COUNT \
-threads $THREADS -target $3 -s


50 changes: 50 additions & 0 deletions benchmarks/data-serving/client/warmup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/bin/bash

# This script helps to fill the server database with given data set size.
# Usage: warmup.sh <server_ip> <record_count> <threads=1>
# Each record takes 1KB to store, so if you want a 10GB database, just giving 10M records.

if [ -z $3 ]; then
THREADS=1
else
THREADS=$3
fi

echo '======================================================'
echo "server IP: $1"
echo "Fill the database with $2 records"
echo "Load generator threads count: $THREADS"
echo '======================================================'



echo '======================================================'
echo 'Creating a usertable for the seed server'
echo '======================================================'

first_server=$(cut -d',' -f1 <<< "$1")

exit=0
while [ $exit -eq 0 ]; do
set +e
cqlsh -f /setup_tables.txt $first_server
if [[ "$?" -eq 0 ]]; then
exit=1
else
echo 'Cannot connect to the seed server. Trying again...'
fi
set -e
sleep 5
done

echo '======================================================'
echo 'Populate the database'
echo '======================================================'

/ycsb/bin/ycsb load cassandra-cql -p hosts=$1 -P /ycsb/workloads/workloada -p recordcount=$2 -s -threads $THREADS

echo '======================================================'
echo 'Warm up is done.'
echo '======================================================'


0 comments on commit b824308

Please sign in to comment.