Swingbench - What is it?
Swingbench is a free load generator written in Java by Dominic Giles who works for Oracle in the UK. It generates some load and measures the response time and number of transactions - and you get nice little graphs.

It is a very good tool to demonstrate for example the capabilities of the IBM Advanced POWER Virtualization because it is mainly using CPU.
And it works with a normal Oracle database as well as with Real Application Cluster (RAC)!
And it's easy to use and setup.
Where to get it?
Simply download the tool from Dominic Giles home page here
Installing swingbench.
After you've downloaded the swingbench zip archive just unzip it to a folder of your choice.
[root@bc1-js21-1-lpar1 tmp]# unzip /mnt/swingbench/swingbench22.zip
Archive: /mnt/swingbench/swingbench22.zip
creating: swingbench/
...
That's it!
Configure Swingbench
Actually there are two configuration files you must adjust in order to make swingbench work:
- <swingbench_directory>/swingbench.env
- <swingbench_directory>/bin/swingconfig.xml (optional)
swingbench.env
This configuration files includes all necessary environment settings like JAVA_HOME and ORACLE_HOME.
You can find it in the installation directory where you've unzipped swingbench. Here's an example of a swingbench configuration file I am using on a system.
#!/bin/bash
export ORACLE_HOME=/opt/oracle/app/oracle/product/10.2.0.1/rdbms
export JAVAHOME=/opt/ibm/java2-ppc64-50
export SWINGHOME=/opt/oracle/swingbench
export ANTHOME=$SWINGHOME/lib
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/lib
export LOADGENHOSTS='localhost'
export LOADGENUSER=oracle
export CLASSPATH=$JAVAHOME/lib/rt.jar:$JAVAHOME/lib/tools.jar:$ORACLE_HOME/jdbc/lib/ojdbc14.jar:$SWINGHOME/lib/mytransactions.jar:${SWINGHOME}/lib/swingbench.jar:$ANTHOME/ant.jar
Adjust ORACLE_HOME, JAVAHOME and SWINGHOME accordingly.
swingconfig.xml
The swingconfig.xml configuration files includes a lot of default values swingbench is using at startup, like user id and password or connection string. Although it is optional to adjust this file it make some sense if you want to avoid to input the correct settings each time.
You can find swingconfig.xml in the swingbench directory in bin/.
Running Swingbench
Running swingbench is easy. After you've adjusted at least swingbench.env just change to the swingbench/bin directory. Then just type ./swingbench
[root@bc1-js21-1-lpar1 ~]# cd /opt/oracle/swingbench/bin/
[root@bc1-js21-1-lpar1 bin]# ./swingbench
Started Swingbench, Version 2.2 using config file swingconfig.xml
BI Beans Graph version [2.7.5.32] Engine version [2.7.5.32]

After a few moments the swingbench is up and running and you can start with it.
Hmmm but I don't have any data on my Oracle database
Well that's a good point. In general you'll have the option to work with your own data and adjust swingbench to your needs.
Another way is to generate an Oracle database and load some generic data into it which you can use for swingbench. This especially is an easy and comfortable way to go. Thanks to Dominic Giles there's a second tool available called datagenerator.
Ok, where do I get the datagenerator?
On Dominic's web page in the download section - here
 | Please note...
Datagenerator requires Java 1.5!!! |
How to install datagenerator?
Just like Swingbench just download the tool to a location of your choice and unzip the archive - that's it.
Joking, right? How to configure it?
Guess what - there's a configuration file in the datagenerator directory called datagenerator.env. Adjust the file according to your environment - set ORACLE_HOME, JAVAHOME and DATAGENHOME.
#!/bin/bash
export ORACLE_HOME=/opt/oracle/app/oracle/product/10.2.0.1/rdbms
export JAVAHOME=/opt/ibm/java2-ppc64-50
export DATAGENHOME=/opt/oracle/datagenerator
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/lib
export CLASSPATH=$JAVAHOME/lib/rt.jar:$JAVAHOME/lib/tools.jar:$ORACLE_HOME/jdbc/lib/ojdbc14.jar:$DATAGENHOME/lib/datagenerator.jar
Ok - running datagenerator and now?
After you've adjusted datagenerator.env change to the bin/ subdirectory of datagenerator and type - correct - ./datagenerator.

You'll have two choices how to get to your data:
- Using an existing database schema
- Using an sample schema
There's an excellent walkthrough descriping method 1. on Dominic's page here
.
I will concentrate on possibility 2. because I do not have an existing Oracle database I can use.
After you've started datagenerator, select File -> Open and in the Open-Dialog choose either soe.xml or sh.xml.
Now you'll have two choice how to go on:
- Load the data directly into the database
- Export the data to a directory and load it manually
Well the first point sounds great but so far I had no luck doing it this way.
So let's have a closer look at possibility 2.
After you've loaded a sample schema select Start -> Start datageneration to file.
Specify where you want to save the data and if it should be compressed or not and how many threads you want to use (more threads, faster creation).

Selecting Next will start the generation.

As soon as it has completed the data generation press Finish and exit the datagenerator.
Now change to the subdirectory bin/scripts/soe or bin/scripts/sh depending on the sample schema you've choosen. Here you'll find a lot of sql files which are used to create and load the database. In order to load it you should adjust or at least take a look at the soe_install.sql file. Change the username and password if you'll like and think about the tablespace parameter and the connection string. I found it necessary to add the database SID behind it. Save any changes to the file and connect to your Oracle database. Then execute the sql file called soe_install.sql and follow the instructions on the screen.
SQL*Plus: Release 10.2.0.1.0 - Production on Thu Dec 28 22:33:42 2006
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> @soe_install.sql
This script will create a user : soe
With a password : oracle
And set its default tablespace to : USERS
It wil put its indexes in this tablespace : USERS
If this isnt correct hit control C and edit this script, otherwisw hit return
...
...skipping some output...
...
Commit complete.
Now run the loader scripts in another window, theyll be in the data directory.
In unix/linux a command like this will do it. for i in `ls *.ctl`; do sqlldr dom/dom control=$i; done
Hit return when youve loaded them
...
...changing to another session...
...
oracle@bc1-js21-1-lpar2:~> cd /opt/oracle/datagenerator/bin/data/
oracle@bc1-js21-1-lpar2:/opt/oracle/datagenerator/bin/data> for i in `ls *.ctl`; do sqlldr soe/oracle@orcl2 control=$i; done
SQL*Loader: Release 10.2.0.1.0 - Production on Thu Dec 28 22:42:08 2006
Copyright (c) 1982, 2005, Oracle. All rights reserved.
...
...Waiting for the data to be loaded and after that switching back to session 1...
...
Tidying up, building indexes, analysing data... This may take a while...
...
...waiting...
...
finished running the order entry scripts
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
And that's it - now you'll have an sample database which you can use with swingbench.
 | Please note...
Don't forget to adjust the number of concurrent sessions in order to stress your database. |
Ok - try Swingbench again
Now that you have a sample database up and running let's try swingbench again. Change to the swingbench bin/ directory and type ./swingbench.
Use the correct username/password and connection string to connect to the database and adjust the other values and transactions to your needs. Finally start the benchmark run.

There are a lot of options and graphs you can try. Moreover you can demonstrate the behaviour of the Advanced POWER Virtualization by changing values on the fly (like capped vs. uncapped) etc.
Have fun 
Links