Skip to content

Commit 154d567

Browse files
committed
Add assemblies
1 parent 290e6e4 commit 154d567

File tree

10 files changed

+465
-12
lines changed

10 files changed

+465
-12
lines changed

pom.xml

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
<groupId>com.rabbitmq</groupId>
77
<artifactId>perf-test</artifactId>
8-
<version>4.0.0-SNAPSHOT</version>
8+
<version>1.0.0-SNAPSHOT</version>
99
<packaging>jar</packaging>
1010

1111
<name>RabbitMQ Performance Testing Tool</name>
@@ -166,17 +166,6 @@
166166
</configuration>
167167
</plugin>
168168

169-
<plugin>
170-
<groupId>org.apache.maven.plugins</groupId>
171-
<artifactId>maven-jar-plugin</artifactId>
172-
<version>3.0.2</version>
173-
<configuration>
174-
<archive>
175-
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
176-
</archive>
177-
</configuration>
178-
</plugin>
179-
180169
<plugin>
181170
<groupId>org.sonatype.plugins</groupId>
182171
<artifactId>nexus-staging-maven-plugin</artifactId>
@@ -194,6 +183,28 @@
194183
<artifactId>versions-maven-plugin</artifactId>
195184
<version>2.3</version>
196185
</plugin>
186+
187+
<plugin>
188+
<artifactId>maven-assembly-plugin</artifactId>
189+
<version>2.6</version>
190+
<configuration>
191+
<descriptors>
192+
<descriptor>src/assembly/dist-bin.xml</descriptor>
193+
<descriptor>src/assembly/dist-src.xml</descriptor>
194+
</descriptors>
195+
</configuration>
196+
197+
<executions>
198+
<execution>
199+
<id>create-archive</id>
200+
<phase>package</phase>
201+
<goals>
202+
<goal>single</goal>
203+
</goals>
204+
</execution>
205+
</executions>
206+
</plugin>
207+
197208
</plugins>
198209
</build>
199210

scripts/PerfTest

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
SCRIPTDIR=$(dirname "$0")
6+
SRCDIR=$(cd "$SCRIPTDIR"/.. && pwd)
7+
8+
(
9+
cd "$SRCDIR"
10+
mvn -q test-compile -P '!setup-test-cluster'
11+
mvn -q exec:java \
12+
-Dexec.mainClass="com.rabbitmq.examples.PerfTest" "$@"
13+
)

scripts/runjava

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
#!/usr/bin/env bash
2+
3+
# OS specific support (must be 'true' or 'false').
4+
cygwin=false;
5+
darwin=false;
6+
case "`uname`" in
7+
CYGWIN*)
8+
cygwin=true
9+
;;
10+
11+
Darwin*)
12+
darwin=true
13+
;;
14+
esac
15+
16+
# For Cygwin, ensure paths are in UNIX format before anything is touched.
17+
if $cygwin ; then
18+
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
19+
fi
20+
21+
# Attempt to find JAVA_HOME if not already set
22+
if [ -z "${JAVA_HOME}" ]; then
23+
if $darwin ; then
24+
[ -z "$JAVA_HOME" -a -f "/usr/libexec/java_home" ] && export JAVA_HOME=`/usr/libexec/java_home`
25+
[ -z "$JAVA_HOME" -a -d "/Library/Java/Home" ] && export JAVA_HOME="/Library/Java/Home"
26+
[ -z "$JAVA_HOME" -a -d "/System/Library/Frameworks/JavaVM.framework/Home" ] && export JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Home"
27+
else
28+
javaExecutable="`which javac`"
29+
[ -z "$javaExecutable" -o "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ] && echo "JAVA_HOME not set and cannot find javac to deduce location, please set JAVA_HOME." && exit 1
30+
# readlink(1) is not available as standard on Solaris 10.
31+
readLink=`which readlink`
32+
[ `expr "$readLink" : '\([^ ]*\)'` = "no" ] && echo "JAVA_HOME not set and readlink not available, please set JAVA_HOME." && exit 1
33+
javaExecutable="`readlink -f \"$javaExecutable\"`"
34+
javaHome="`dirname \"$javaExecutable\"`"
35+
javaHome=`expr "$javaHome" : '\(.*\)/bin'`
36+
JAVA_HOME="$javaHome"
37+
export JAVA_HOME
38+
fi
39+
fi
40+
41+
# Sanity check that we have java
42+
if [ ! -f "${JAVA_HOME}/bin/java" ]; then
43+
echo ""
44+
echo "======================================================================================================"
45+
echo " Please ensure that your JAVA_HOME points to a valid Java SDK."
46+
echo " You are currently pointing to:"
47+
echo ""
48+
echo " ${JAVA_HOME}"
49+
echo ""
50+
echo " This does not seem to be valid. Please rectify and restart."
51+
echo "======================================================================================================"
52+
echo ""
53+
exit 1
54+
fi
55+
56+
# Attempt to find TOOLS_HOME if not already set
57+
if [ -z "${TOOLS_HOME}" ]; then
58+
# Resolve links: $0 may be a link
59+
PRG="$0"
60+
# Need this for relative symlinks.
61+
while [ -h "$PRG" ] ; do
62+
ls=`ls -ld "$PRG"`
63+
link=`expr "$ls" : '.*-> \(.*\)$'`
64+
if expr "$link" : '/.*' > /dev/null; then
65+
PRG="$link"
66+
else
67+
PRG=`dirname "$PRG"`"/$link"
68+
fi
69+
done
70+
SAVED="`pwd`"
71+
cd "`dirname \"$PRG\"`/../" >&-
72+
export TOOLS_HOME="`pwd -P`"
73+
cd "$SAVED" >&-
74+
fi
75+
76+
if [ ! -d "${TOOLS_HOME}" ]; then
77+
echo "Not a directory: TOOLS_HOME=${TOOLS_HOME}"
78+
echo "Please rectify and restart."
79+
exit 2
80+
fi
81+
82+
CLASSPATH=.:${TOOLS_HOME}/bin
83+
if [ -d ${TOOLS_HOME}/ext ]; then
84+
CLASSPATH=$CLASSPATH:${TOOLS_HOME}/ext
85+
fi
86+
for f in ${TOOLS_HOME}/lib/*; do
87+
CLASSPATH=$CLASSPATH:$f
88+
done
89+
90+
if $cygwin; then
91+
TOOLS_HOME=`cygpath --path --mixed "$TOOLS_HOME"`
92+
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
93+
fi
94+
95+
"${JAVA_HOME}/bin/java" ${JAVA_OPTS} -cp "$CLASSPATH" "$@"

scripts/runjava.bat

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
@if "%DEBUG%" == "" @echo off
2+
3+
@rem Set local scope for the variables with windows NT shell
4+
if "%OS%"=="Windows_NT" setlocal
5+
6+
:setToolsHome
7+
@rem Setup TOOLS_HOME if not already defined
8+
if defined TOOLS_HOME goto setJavaHome
9+
set DIRNAME=%~dp0
10+
if "%DIRNAME%" == "" set DIRNAME=.
11+
set TOOLS_HOME=%DIRNAME%\..
12+
13+
:setJavaHome
14+
@rem Find java.exe
15+
if defined JAVA_HOME goto findJavaFromJavaHome
16+
set JAVA_EXE=java.exe
17+
%JAVA_EXE% -version >NUL 2>&1
18+
if "%ERRORLEVEL%" == "0" goto runSpring
19+
echo.
20+
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
21+
echo.
22+
echo Please set the JAVA_HOME variable in your environment to match the
23+
echo location of your Java installation.
24+
goto fail
25+
26+
:findJavaFromJavaHome
27+
set JAVA_HOME=%JAVA_HOME:"=%
28+
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
29+
if exist "%JAVA_EXE%" goto runSpring
30+
echo.
31+
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
32+
echo.
33+
echo Please set the JAVA_HOME variable in your environment to match the
34+
echo location of your Java installation.
35+
goto fail
36+
37+
:runSpring
38+
@rem Get command-line arguments, handling Windows variants
39+
40+
if not "%OS%" == "Windows_NT" goto win9xME_args
41+
if "%@eval[2+2]" == "4" goto 4NT_args
42+
43+
:win9xME_args
44+
@rem Slurp the command line arguments.
45+
set CMD_LINE_ARGS=
46+
set _SKIP=2
47+
48+
:win9xME_args_slurp
49+
if "x%~1" == "x" goto execute
50+
51+
set CMD_LINE_ARGS=%*
52+
goto execute
53+
54+
:4NT_args
55+
@rem Get arguments from the 4NT Shell from JP Software
56+
set CMD_LINE_ARGS=%$
57+
58+
:execute
59+
@rem Setup the command line
60+
61+
set CLASSPATH=%TOOLS_HOME%\lib\*
62+
"%JAVA_EXE%" %JAVA_OPTS% -cp "%CLASSPATH%" %CMD_LINE_ARGS%
63+
64+
:end
65+
@rem End local scope for the variables with windows NT shell
66+
if "%ERRORLEVEL%"=="0" goto mainEnd
67+
68+
:fail
69+
rem Set variable TOOLS_EXIT_CONSOLE if you need the _script_ return code instead of
70+
rem the _cmd.exe /c_ return code!
71+
if not "" == "%TOOLS_EXIT_CONSOLE%" exit 1
72+
exit /b 1
73+
74+
:mainEnd
75+
if "%OS%"=="Windows_NT" endlocal

scripts/runperftest

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/sh
2+
3+
run() {
4+
echo "=== running with '$2'"
5+
sh `dirname $0`/runjava com.rabbitmq.examples.PerfTest -h $1 -z 10 -i 20 $2
6+
sleep 2
7+
}
8+
9+
for sz in "" "-s 1000"; do
10+
for pers in "" "-f persistent"; do
11+
for args in \
12+
"" \
13+
"-a" \
14+
"-m 1" \
15+
"-m 1 -n 1" \
16+
"-m 10" \
17+
"-m 10 -n 10" \
18+
; do
19+
run $1 "${args} ${pers} ${sz}"
20+
done
21+
done
22+
done
23+
24+
for args in "-a -f mandatory" "-a -f mandatory -f immediate"; do
25+
run $1 "$args"
26+
done

scripts/runperftestMaven

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/sh
2+
3+
cd `dirname $0`/..
4+
run() {
5+
echo "=== running with '$2'"
6+
mvn -q exec:java -Dexec.mainClass="com.rabbitmq.examples.PerfTest" -Dexec.args=" -h $1 -z 10 -i 20 $2"
7+
sleep 2
8+
}
9+
10+
for sz in "" "-s 1000"; do
11+
for pers in "" "-f persistent"; do
12+
for args in \
13+
"" \
14+
"-a" \
15+
"-m 1" \
16+
"-m 1 -n 1" \
17+
"-m 10" \
18+
"-m 10 -n 10" \
19+
; do
20+
run $1 "${args} ${pers} ${sz}"
21+
done
22+
done
23+
done
24+
25+
for args in "-a -f mandatory" "-a -f mandatory -f immediate"; do
26+
run $1 "$args"
27+
done

scripts/stresspersister

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
#!/bin/sh
2+
3+
commentText=$1
4+
shift
5+
6+
if [ -z "$commentText" ]; then
7+
echo "Comment text must be supplied!"
8+
exit 1
9+
fi
10+
11+
echo "Comment text: $commentText. Press enter to continue."
12+
read dummy
13+
14+
function run1 {
15+
(while true; do (date +%s.%N; ps ax -o '%mem rss sz vsz args' | grep "beam.*-s rabbit" | grep -v grep) | tr '\n' ' ' | awk '{print $1,$2/100,$3,$4,$5}'; sleep 1; done) > memlog.txt &
16+
memlogger=$!
17+
echo "STARTED MEMLOGGER $memlogger"
18+
sleep 2
19+
sh ./runjava com.rabbitmq.examples.StressPersister -B $1 -b $2 -C $commentText | tee stressoutput.txt
20+
logfile=$(head -1 stressoutput.txt)
21+
sleep 2
22+
kill $memlogger
23+
echo "STOPPED MEMLOGGER $memlogger"
24+
baselog=$(basename $logfile .out)
25+
mv memlog.txt $baselog.mem
26+
grep -v '^#' $logfile > stressoutput.txt
27+
mv stressoutput.txt $logfile
28+
}
29+
30+
function run32b {
31+
run1 32b 5000
32+
run1 32b 10000
33+
run1 32b 20000
34+
run1 32b 40000
35+
run1 32b 80000
36+
}
37+
38+
function run1m {
39+
run1 1m 125
40+
run1 1m 250
41+
run1 1m 500
42+
run1 1m 1000
43+
run1 1m 2000
44+
run1 1m 4000
45+
}
46+
47+
function chartall {
48+
for logfile in *.out
49+
do
50+
echo $logfile
51+
baselog=$(basename $logfile .out)
52+
firsttimestamp=$(cat $baselog.mem | head -1 | awk '{print $1}')
53+
cat > $baselog.gnuplot <<EOF
54+
set terminal png size 1024, 768
55+
set logscale y
56+
set xlabel "Time, seconds"
57+
set ylabel "Round-trip time, microseconds"
58+
set y2label "VSZ, megabytes"
59+
set y2range [0 : 1048576]
60+
set y2tics
61+
set ytics nomirror
62+
set autoscale y2
63+
plot '$logfile' using ((\$1 / 1000) - $firsttimestamp):2 title 'RTT' axes x1y1 with lines, \
64+
'$baselog.mem' using (\$1 - $firsttimestamp):(\$5 / 1024) title 'VSZ' axes x1y2 with lines
65+
EOF
66+
gnuplot $baselog.gnuplot > $baselog.png
67+
done
68+
}
69+
70+
run32b
71+
run1m
72+
chartall

0 commit comments

Comments
 (0)