1
HammerDB DB2 Quick Start
This quick start tutorial gets you up and running with the essentials of load testing and benchmarking for the IBM DB2 Database.
Install DB2 Server ... 1
Optional: Install DB2 Client Software for Networked Access ... 3
Install HammerDB ... 4
Build a DB2 Test Schema ... 5
Run a DB2 Load Test ... 8
Support and Questions ... 15
Install DB2 Server
IBM provide DB2 in a virtual appliance format with a pre-configured DB2 test database in a Linux
operating system. This provides the most rapid way to install and configure DB2 and the
recommended virtual environment for DB2 VM testing is Oracle VirtualBox.
Figure 1 Oracle VirtualBox
Alternatively IBM also offer DB2 Express-C as a freely available version of DB2 that can be run in
the 32 or 64-bit Windows and Linux environments that HammerDB supports.
2
Figure 2 DB2 Running3
Figure 3 DB2 Database Created
Optional: Install DB2 Client Software for Networked Access
Alternatively if you already have a DB2 database running and you wish to connect across a
network HammerDB only requires the IBM Data Server Driver for ODBC and CLI. Note that
HammerDB connects to DB2 via CLI as the db2tcl interface is C based interface enabling CLI
connectivity. ODBC is not used for HammerDB connectivity to DB2.
Figure 5 Data Server Driver
Configure your
db2dsdriver.cfgfile with the hostname, port and database that you have
created on the server.
db2inst1:~/odbc_cli/clidriver/cfg> more db2dsdriver.cfg <?xml version="1.0" encoding="UTF-8" standalone="no" ?> <configuration>
<dsncollection>
<dsn alias="TPCC" host="db2v1032bit" name="TPCC" port="50001"/> </dsncollection>
4
<databases><database host="db2v1032bit" name="TPCC" port="50001"/> </databases>
</configuration>
Install HammerDB
To install HammerDB follow the HammerDB installation guide. Before proceeding you should have
your DB2 database software installed and running. Firstly you will need to select which
benchmark and database you wish to use by choosing select benchmark from under the TPC
menu. The initial settings are determined by the values in your config.xml file. Select DB2 and
TPC-C and press OK as shown in Figure 6.
Figure 6 Select Benchmark
5
Figure 7 TPC-C Schema Options
Build a DB2 Test Schema
Click on the Benchmark tree view and under TPC-C select TPC-C Schema options to display the
TPC-C Schema options window as shown in Figure 8. Within this window enter the details for DB2
connectivity. The specified database will be created during installation. Select a number of
warehouses with the slider, 5 is good for a first test under a VM and set the Virtual Users to build
schema to the number of virtual CPU cores on your guest system. Click OK.
6
Figure 8 Build OptionsDouble-click on the Build option as shown in Figure 9.
7
On the Create Schema prompt check the details and Click Yes.
Figure 10 Confirm Schema
Wait for the Schema creation to complete, the time to completion depends on your system but should normally be less than 10 minutes.
8
Figure 12 Schema Build Complete
When the Display shows TPCC SCHEMA COMPLETE and all users have completed successfully the build is finished. Press the red traffic light icon to close the users down.
Run a DB2 Load Test
You can now proceed to run a load test against your created schema. Under the benchmark tree view select Driver Script and options. The choices to select for the driver script are displayed. Note that the database name and usernames if changed for the build options will also be reflected here. Accept the default values and click OK.
9
Figure 14 Driver OptionsNow select the Driver Script option and double-click on Load as shown in Figure 15, this populates the Script Editor window with the driver script. You can observe that the EDITABLE OPTIONS correspond to the driver script options set in the previous step. You do not need to edit the script.
10
Figure 15 TPC-C Driver Script
Under the Virtual User view double-click on Options and enter the number of users you wish to run against your system. Don’t select too many to start with as the workload is intensive. If you wish check the Show Output button to see what your users are doing whilst the test is running, however note that displaying the output will reduce the overall level of performance and click OK.
Figure 16 Select Virtual Users
11
running yet.Figure 17 Create Virtual Users
You can observe that the virtual users have been created but their status is shown as waiting. Now click the Run Virtual Users button as shown in Figure 18 to start the test. The virtual users will begin to execute the driver script in the Script Editor Window.
12
Figure 18 Virtual Users Created and Run
13
Figure 19 Load Testing Running
By clicking on the pencil icon shown in Figure 19 you can observe the transaction rate reported by DB2.
14
Also observe with HammerDB Metricsthat a load has been placed on the system.
Figure 21 HammerDB Metrics
The load will complete when all virtual users have completed the number of transactions you defined or can be stopped by pressing the red traffic light icon as shown in Figure 22 to destroy the virtual users.
15
HammerDB users of other databases should note that at the present time DB2 does not make Transaction Counter statistics queryable and therefore a transaction counter is not available. Performance statistics are available as NOPM by running a timed test. For next steps such as running timed and automated tests follow the Introduction to Transactional (OLTP) Load Testing for all Databases.