Skip to content

Commit

Permalink
Merge pull request #66 from VoltDB/ENG-3312
Browse files Browse the repository at this point in the history
Add measure overhead benchmark for ENG-3312.
  • Loading branch information
Ryan Betts committed Jul 5, 2012
2 parents 09a17e4 + 84b1f4b commit a67b30f
Show file tree
Hide file tree
Showing 11 changed files with 584 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/test_apps/overhead/ddl.sql
@@ -0,0 +1,7 @@
CREATE TABLE store
(
key bigint not null
, value varbinary(1048576) not null
, PRIMARY KEY (key)
);

7 changes: 7 additions & 0 deletions tests/test_apps/overhead/deployment.xml
@@ -0,0 +1,7 @@
<?xml version="1.0"?>
<deployment>
<cluster hostcount="1" sitesperhost="3" kfactor="0" />
<httpd enabled="true">
<jsonapi enabled="true" />
</httpd>
</deployment>
28 changes: 28 additions & 0 deletions tests/test_apps/overhead/log-client.xml
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<appender name="voltfile" class="org.apache.log4j.FileAppender">
<param name="File" value="key-value-client.log" />
<param name="ImmediateFlush" value="true" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern"
value="%-5p %d{ISO8601} [%t] %c: %m%n"/>
</layout>
</appender>
<appender name="Console" class="org.apache.log4j.ConsoleAppender">
<param name="Target" value="System.out" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern"
value="%-5p %d{ISO8601} [%t] %c: %m%n"/>
</layout>
</appender>
<appender name="Async" class="org.apache.log4j.AsyncAppender">
<param name="Blocking" value="true" />
<appender-ref ref="Console" />
<appender-ref ref="voltfile" />
</appender>
<root>
<priority value="info" />
<appender-ref ref="Async" />
</root>
</log4j:configuration>
28 changes: 28 additions & 0 deletions tests/test_apps/overhead/log-server.xml
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<appender name="voltfile" class="org.apache.log4j.FileAppender">
<param name="File" value="key-value-server.log" />
<param name="ImmediateFlush" value="true" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern"
value="%-5p %d{ISO8601} [%t] %c: %m%n"/>
</layout>
</appender>
<appender name="Console" class="org.apache.log4j.ConsoleAppender">
<param name="Target" value="System.out" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern"
value="%-5p %d{ISO8601} [%t] %c: %m%n"/>
</layout>
</appender>
<appender name="Async" class="org.apache.log4j.AsyncAppender">
<param name="Blocking" value="true" />
<appender-ref ref="Console" />
<appender-ref ref="voltfile" />
</appender>
<root>
<priority value="info" />
<appender-ref ref="Async" />
</root>
</log4j:configuration>
17 changes: 17 additions & 0 deletions tests/test_apps/overhead/project.xml
@@ -0,0 +1,17 @@
<?xml version="1.0"?>
<project>
<database>
<schemas>
<schema path='ddl.sql' />
</schemas>
<procedures>
<procedure class='overhead.procedures.NoArgs' />
<procedure class='overhead.procedures.BinaryPayload' />
<procedure class='overhead.procedures.NoArgsRW' />
<procedure class='overhead.procedures.BinaryPayloadRW' />
</procedures>
<partitions>
<partition table='store' column='key' />
</partitions>
</database>
</project>
78 changes: 78 additions & 0 deletions tests/test_apps/overhead/run.sh
@@ -0,0 +1,78 @@
#!/usr/bin/env bash

APPNAME="overhead"
CLASSPATH="`ls -x ../../../voltdb/voltdb-*.jar | tr '[:space:]' ':'``ls -x ../../../lib/*.jar | tr '[:space:]' ':'`"
VOLTDB="../../../bin/voltdb"
VOLTCOMPILER="../../../bin/voltcompiler"
LOG4J="`pwd`/../../../voltdb/log4j.xml"
LICENSE="../../../voltdb/license.xml"
LEADER="localhost"

# remove build artifacts
function clean() {
rm -rf obj debugoutput $APPNAME.jar voltdbroot voltdbroot
}

# compile the source code for procedures and the client
function srccompile() {
mkdir -p obj
javac -classpath $CLASSPATH -d obj \
src/overhead/*.java \
src/overhead/procedures/*.java
# stop if compilation fails
if [ $? != 0 ]; then exit; fi
}

# build an application catalog
function catalog() {
srccompile
$VOLTCOMPILER obj project.xml $APPNAME.jar
# stop if compilation fails
if [ $? != 0 ]; then exit; fi
}

# run the voltdb server locally
function server() {
# if a catalog doesn't exist, build one
if [ ! -f $APPNAME.jar ]; then catalog; fi
# run the server
$VOLTDB create catalog $APPNAME.jar deployment deployment.xml \
license $LICENSE leader $LEADER
}

# run the client that drives the example
function client() {
async-benchmark
}

# Asynchronous benchmark sample
# Use this target for argument help
function async-benchmark-help() {
srccompile
java -classpath obj:$CLASSPATH:obj overhead.AsyncBenchmark --help
}

function async-benchmark() {
srccompile
java -classpath obj:$CLASSPATH:obj -Dlog4j.configuration=file://$LOG4J \
overhead.AsyncBenchmark \
--displayinterval=5 \
--duration=60 \
--operation=BinaryPayloadRW \
--servers=localhost \
--port=21212 \
--resultsize=0 \
--paramsize=0 \
--ratelimit=900000
}



function help() {
echo "Usage: ./run.sh {clean|catalog|server|async-benchmark|aysnc-benchmark-help|...}"
}

# Run the target passed as the first arg on the command line
# If no first arg, run server
if [ $# -gt 1 ]; then help; exit; fi
if [ $# = 1 ]; then $1; else server; fi

0 comments on commit a67b30f

Please sign in to comment.