-
Notifications
You must be signed in to change notification settings - Fork 13
Install and Run
This page shows you how to install and run live demonstrations of "write once, run anywhere" Java performance problems. To build the war file and create the database, you must run a one-time init.sh/init.cmd script that takes about 5-10 minutes to run.
There are 13 different performance examples, each has two tests -- an 'a' test and a 'b' test, and one test will perform better than the other. Run each test one at a time, for about 3-5 minutes each. Decide which test is slower by looking at the load gen metrics. Hook up your choice of monitoring tools to find out what's slowing down the slower test.
These tests run on any platform with Java. Tested on MacOS(10.10.5) and Linux(Ubuntu 14.04). MS-Windows still needs testing but should work. Here is a quick overview of the processes running in the test.
Before running a test, you will need to install a few dependencies and run a single script -- init.sh. This one-time script compiles/builds the war file and create/populates the db with a few million rows.
- Install JDK 1.8 or greater. Make sure JAVA_HOME is points to the folder of your Java 1.8 installation.
- Make sure JAVA_HOME/bin is in the PATH.
- Install Maven (http://maven.apache.org). Make sure 'mvn' is in the PATH. It is a bit long, but here is a nice maven introduction and install video.
- An internet connection is required while the scripts are running to download dependencies.
- Hardware recommendations: 1 machine with 2 cores, at least 4gb of RAM. 1gb disk space is required for the db.
-
Clone the repo from github.com: https://github.com/eostermueller/performanceGolf (or download and unzip).
-
The folder with README.md will be referred to as PG_HOME.
-
Open a prompt/terminal and 'cd' to the PG_HOME folder.
-
Run the init script to create the war file and the database.
'cd' to the PG_HOME folder. For MS-Windows: run init.cmd For Bash: chmod +x init.sh and run ./init.sh
This will take 5-10 minutes to populate the 1gb db.
When the script is finished, you will see this:
@@ Here are row counts of tables:
@@
[INFO] S01.BRANCHES=100
[INFO] S01.ACCOUNTS=125000
[INFO] S01.HISTORY=1250000
[INFO] S02.BRANCHES=100
[INFO] S02.ACCOUNTS=250000
[INFO] S02.HISTORY=2500000
Shutting down TCP Server at tcp://localhost:9092
@@
@@ init.sh is finished.
@@ The db has been stopped.
Once you launch the db, you can keep it running for all examples/tests. But each test has its own war file launch and load generation launch, which you should start and stop before and after each test.
Three windows are required for each test -- one for the db, war, and load generation. Additional windows are sometimes required for troubleshooting.
The program tmux is real helpful for working with multiple windows. Here is a screencast using a few tmux windows to run "init.sh" -- only need to run this once. Running init.sh multiple times will just rebuild the db from scratch.
- Launch test 01a. (Screencast to launch test 01a)
If PG_HOME/db/startDb.sh is not already started, then run it. The window will block with this message:
TCP server running at tcp://192.168.1.66:9092 (only local connections)
Web Console server running at http://192.168.1.66:8082 (only local connections)
There are 12 pairs of tests: 01a and 01b, 02a and 02b, 03a and 03b....etc, up to 12a and 12b.
-
Start the 04a war file like this: 'cd' to the PG_HOME folder and run this: ./startWar.sh 04a The war file is started when you see a message like this:
Started PerformanceSandboxApp in 10.87 seconds (JVM running for 11.566)
-
Apply load like this: ./load.sh 04a.jmx
Let the load test run for a few minutes then use "Ctrl+C" to stop both the load.sh and the startWar.sh script. Also make sure there are no errors (Err: 0 (0.00%)
, might have to scroll to the right below to see it).
[INFO] Waiting for possible Shutdown/StopTestNow/Heapdump message on port 4445
[INFO] summary + 1 in 00:00:01 = 1.0/s Avg: 859 Min: 859 Max: 859 Err: 0 (0.00%) Active: 1 Started: 1 Finished: 0
[INFO] summary + 5 in 00:00:09 = 0.6/s Avg: 4192 Min: 2958 Max: 5234 Err: 0 (0.00%) Active: 3 Started: 3 Finished: 0
[INFO] summary = 6 in 00:00:10 = 0.6/s Avg: 3637 Min: 859 Max: 5234 Err: 0 (0.00%)
[INFO] summary + 7 in 00:00:10 = 0.7/s Avg: 4279 Min: 2879 Max: 5671 Err: 0 (0.00%) Active: 3 Started: 3 Finished: 0
[INFO] summary = 13 in 00:00:20 = 0.7/s Avg: 3982 Min: 859 Max: 5671 Err: 0 (0.00%)
The lines with '+' are from the most recent 10 seconds. The lines with '=' are from the very start f the test. This JMeter doc has more details.
Take note of the throughput in the test and stop the load and startWar scripts. Then repeat the above process, but use '04b' and '04b.jmx' for the load.sh and startWar script parameters.
Now, compare the throughput of the two tests. Which test has higher throughput? Use monitoring tools of your choice to determine why one test has less throughput than the other.