DBT3 Automation Scripts

DBT-3 (OSDL Database Test 3) is a workload tool for the Linux kernel that OSDL (Open Source Development Labs, inc) developed based on TPC-H which is provided by the Transaction Performance Processing Council (TPC).

DBT-3, like TPC-H, simulates an actual decision-making support system and models complex business analysis applications that perform data processing jobs for making better business decisions. By running the workload that DBT-3 simulates, it is possible to verify and measure the performances of the Linux kernel in an actual decision-making support system.

DBT-3 uses the "scale factor (SF)" as a stress indicator of the system. By varying the SF, it becomes possible to make the size of a database the SF times its size.

The tests performed by DBT-3 comprise the three tests listed below. DBT-3 obtains the execution times of these three tests as well as the system status information and database statistics information.

  1. Load test

  • Enters the data to be used for the Power and Throughput tests into the database. Makes a bulk insert of the huge CSV data corresponding to the scale factor into the database.

  1. Power test

  • Performs 22 complex queries.

  1. Throughput test

  • Performs the same 22 queries as in the Power test simultaneously in more than one process.

For the purpose of this task, only the Power test is performed over preliminary prepared database with various Scale factors. The time for each query execution will be measured and stored into a database. Later the results of one whole test with all 22 queries will be rendered into a histogram graphics comparing it to different configurations.

Benchmark environment preparation

sudo rights

The user that will run the benchmark must have sudo rights on the machine.

For clearing the system caches between query runs, the automation script uses the following command:

sudo /sbin/sysctl vm.drop_caches=3

This command must be run with superuser rights. Even if a user supplies a password to sudo, this password expires after some timeout. In order for this command to be run without requiring password, the following line should be added to the sudoers file (edit it with the "sudo visudo" command):

...where 'your_username' is the user that will run the benchmark.

Required software

The automated DBT3 benchmark requires the following software:

  • Perl

    • Project home:

  • mariadb-tools

    • Project home: mariadb-tools

    • The project folder is called "dbt3_benchmark" and is under mariadb-tools.

  • dbt3-1.9

    • Download location:

  • Gnuplot 4.4 — graphics output program.

    • Project home:

  • Config::Auto — a Perl module that reads configuration files. To install it use the following command:

  • DBD::mysql — a Perl module to connect to MariaDB/MySQL and PostgreSQL. To install it use the following command:

NOTE: You may receive an error saying that CPAN could not findmysql_config. In this case you have to install the mysql client development library. In OpenSuse the command is:

Alternatively this module can be installed manually by following these steps:

  1. Download DBD-mysql-4.020.tar.gz from mysql.pm and unpack it

  2. Run the perl script PerlMake.pl under the unzipped dir:

  1. Run make to compile DBD::mysql:

  1. Add the necessary paths in order to run DBD::mysql:

Tested DBMS

  • MySQL 5.5.x

    • Download location: #downloads → Generally Available (GA) Releases → Linux - Generic 2.6 (x86, 64-bit), Compressed TAR Archive - downloads mysql-5.5.x-linux2.6-x86_64.tar.gz - gzipped tar file for Linux x86

  • MySQL 5.6.x

    • Download location: #downloads → Development Releases → Linux - Generic 2.6 (x86, 64-bit), Compressed TAR Archive - downloads mysql-5.6.x-m5-linux2.6-x86_64.tar.gz - gzipped tar file for Linux x86

  • MariaDB 5.3.x

    • Download location: 5.3 , downloaded with Bazaar:

NOTE: The DBT3 benchmark requires a lot of disk space (for example MySQL 5.5.x + MyISAM database with scale factor 30 takes about 50 GB). Also some queries require the utilization of temp tables under the directory set by the--tmpdir startup parameter passed to mysqld. In the prepared configuration files the temp directory is pointed to the mysql system directory of the binary distribution, but one should reassure that there is enough free space available for the temp directory.

Installation instructions

NOTE: The directory where all the files will be downloaded or installed will be referred as $PROJECT_HOME. This could be for example ~/benchmark/dbt3.

Download mariadb-tools

  1. Go to your project folder

  1. Get the latest branch from LaunchPad with Bazaar:

Now the project for the dbt3 benchmark test will be in the following dir:

The project dbt3_benchmark has the following directories and files:

  • config — a folder where the configuration files for MariaDB, MySQL and PostgreSQL are stored. They are divided into subfolders named 'sXX', where XX is the scale factor.

  • dbt3_mysql — a folder with all the necessary files for preparing DBT3 databases and queries for the tests with MySQL and MariaDB

  • tests — a folder where the different test configurations are stored. It contains the following directories:

    • db_conf — here are stored the database configuration files

    • queries_conf — here are stored the different queries configuration files

    • results_db_conf — here is stored the configuration of the results database

    • test_conf — here are the test configurations

    • launcher.pl — a perl script that automates the test. Details about calling and functionality of this file are listed later on this page.

Prepare benchmark workload and queries

For the purpose of the benchmark from DBT3-1.9 we will only need DBGEN and QGEN. DBGEN is a tool that generates a workload for the test and QGEN is a tool that generates the queries used for the test.

  1. Go to

  2. Download the archive for DBT3 1.9 into your project folder $PROJECT_HOME

  3. Unzip the archive into your project folder

  1. Copy the file tpcd.h into the dbt3 folder. This step includes the necessary labels for MySQL/MariaDB when building queries.

  1. Copy the file Makefile under $PROJECT_HOME/mariadb-tools/dbt3_benchmark/dbt3_mysql/ into the dbt3 folder

  • NOTE: This step is executed only if you want to overwrite the default behavior of PostgreSQL settings. After copying this Makefile and building the project, QGEN will be set to generate queries for MariaDB/MySQL. If you skip this step, QGEN will generate queries for PostgreSQL by default.

  1. Go to $PROJECT_HOME/dbt3-1.9/src/dbgen and build the project

  1. Set the variable DSS_QUERY to the folder with template queries for MariaDB/MySQL or for PostgreSQL

  2. If you want to build the queries that fit MariaDB/MySQL dialect execute the following command:

  1. If you want to use the default PostgreSQL templates, execute the following command:

  1. Create a directory to store the generated queries in

  1. Generate the queries

NOTE: The examples use scale factor 30. If you want different scale, change the value of -s parameter

cd $PROJECT_HOME/dbt3-1.9/src/dbgen ./qgen -s 30 1 > $PROJECT_HOME/gen_query/s30-m/1.sql ./qgen -s 30 2 > $PROJECT_HOME/gen_query/s30-m/2.sql ./qgen -s 30 3 > $PROJECT_HOME/gen_query/s30-m/3.sql ./qgen -s 30 4 > $PROJECT_HOME/gen_query/s30-m/4.sql ./qgen -s 30 5 > $PROJECT_HOME/gen_query/s30-m/5.sql ./qgen -s 30 6 > $PROJECT_HOME/gen_query/s30-m/6.sql ./qgen -s 30 7 > $PROJECT_HOME/gen_query/s30-m/7.sql ./qgen -s 30 8 > $PROJECT_HOME/gen_query/s30-m/8.sql ./qgen -s 30 9 > $PROJECT_HOME/gen_query/s30-m/9.sql ./qgen -s 30 10 > $PROJECT_HOME/gen_query/s30-m/10.sql ./qgen -s 30 11 > $PROJECT_HOME/gen_query/s30-m/11.sql ./qgen -s 30 12 > $PROJECT_HOME/gen_query/s30-m/12.sql ./qgen -s 30 13 > $PROJECT_HOME/gen_query/s30-m/13.sql ./qgen -s 30 14 > $PROJECT_HOME/gen_query/s30-m/14.sql ./qgen -s 30 15 > $PROJECT_HOME/gen_query/s30-m/15.sql ./qgen -s 30 16 > $PROJECT_HOME/gen_query/s30-m/16.sql ./qgen -s 30 17 > $PROJECT_HOME/gen_query/s30-m/17.sql ./qgen -s 30 18 > $PROJECT_HOME/gen_query/s30-m/18.sql ./qgen -s 30 19 > $PROJECT_HOME/gen_query/s30-m/19.sql ./qgen -s 30 20 > $PROJECT_HOME/gen_query/s30-m/20.sql ./qgen -s 30 21 > $PROJECT_HOME/gen_query/s30-m/21.sql ./qgen -s 30 22 > $PROJECT_HOME/gen_query/s30-m/22.sql

./qgen -s 30 -x 1 > $PROJECT_HOME/gen_query/s30-m/1_explain.sql ./qgen -s 30 -x 2 > $PROJECT_HOME/gen_query/s30-m/2_explain.sql ./qgen -s 30 -x 3 > $PROJECT_HOME/gen_query/s30-m/3_explain.sql ./qgen -s 30 -x 4 > $PROJECT_HOME/gen_query/s30-m/4_explain.sql ./qgen -s 30 -x 5 > $PROJECT_HOME/gen_query/s30-m/5_explain.sql ./qgen -s 30 -x 6 > $PROJECT_HOME/gen_query/s30-m/6_explain.sql ./qgen -s 30 -x 7 > $PROJECT_HOME/gen_query/s30-m/7_explain.sql ./qgen -s 30 -x 8 > $PROJECT_HOME/gen_query/s30-m/8_explain.sql ./qgen -s 30 -x 9 > $PROJECT_HOME/gen_query/s30-m/9_explain.sql ./qgen -s 30 -x 10 > $PROJECT_HOME/gen_query/s30-m/10_explain.sql ./qgen -s 30 -x 11 > $PROJECT_HOME/gen_query/s30-m/11_explain.sql ./qgen -s 30 -x 12 > $PROJECT_HOME/gen_query/s30-m/12_explain.sql ./qgen -s 30 -x 13 > $PROJECT_HOME/gen_query/s30-m/13_explain.sql ./qgen -s 30 -x 14 > $PROJECT_HOME/gen_query/s30-m/14_explain.sql ./qgen -s 30 -x 15 > $PROJECT_HOME/gen_query/s30-m/15_explain.sql ./qgen -s 30 -x 16 > $PROJECT_HOME/gen_query/s30-m/16_explain.sql ./qgen -s 30 -x 17 > $PROJECT_HOME/gen_query/s30-m/17_explain.sql ./qgen -s 30 -x 18 > $PROJECT_HOME/gen_query/s30-m/18_explain.sql ./qgen -s 30 -x 19 > $PROJECT_HOME/gen_query/s30-m/19_explain.sql ./qgen -s 30 -x 20 > $PROJECT_HOME/gen_query/s30-m/20_explain.sql ./qgen -s 30 -x 21 > $PROJECT_HOME/gen_query/s30-m/21_explain.sql ./qgen -s 30 -x 22 > $PROJECT_HOME/gen_query/s30-m/22_explain.sql

mkdir $PROJECT_HOME/gen_data/s30

export DSS_PATH=$PROJECT_HOME/gen_data/s30/

./dbgen -vfF -s 30

gunzip < mysql-5.5.x-linux2.6-x86_64.tar.gz |tar xf -

$PROJECT_HOME/bin/mysql-5.5.x-linux2.6-x86_64/bin/mysqld_safe --datadir=some/data/dir &

gunzip < mysql-5.6.x-m5-linux2.6-x86_64.tar.gz |tar xf -

$PROJECT_HOME/bin/mysql-5.6.x-m5-linux2.6-x86_64/bin/mysqld_safe --datadir=some/data/dir &

bzr branch lp:maria/5.3 mv 5.3/ mariadb-5.3

cd mariadb-5.3/ ./BUILD/compile-amd64-max

./scripts/make_binary_distribution

mv mariadb-5.3.x-beta-linux-x86_64.tar.gz $PROJECT_HOME/bin/ cd $PROJECT_HOME/bin/ tar -xf mariadb-5.3.x-beta-linux-x86_64.tar.gz

$PROJECT_HOME/bin/mariadb-5.3.x-beta-linux-x86_64/bin/mysqld_safe --datadir=some/data/dir &

LOAD DATA INFILE '/some/path/to/gen_data/nation.tbl' into table nation fields terminated by '|';

LOAD DATA INFILE '~/benchmark/dbt3/gen_data/s30/nation.tbl' into table nation fields terminated by '|';

cd $DB_HOME ./scripts/mysql_install_db --defaults-file=$PROJECT_HOME/mariadb-tools/dbt3_benchmark/config/s30/load_mysql_myisam_my.cnf --basedir=$DB_HOME --datadir=$PROJECT_HOME/db_data/myisam-s30/

./bin/mysqladmin --user=root --socket=$PROJECT_HOME/temp/mysql.sock shutdown 0

gunzip < postgresql-9.1rc1.tar.gz |tar xf -

mkdir $PROJECT_HOME/PostgreSQL_bin cd $PROJECT_HOME/postgresql-9.1rc1 ./configure --prefix=$PROJECT_HOME/bin/PostgreSQL_bin make make install

mkdir $PROJECT_HOME/db_data/postgre_s30 cd $PROJECT_HOME/bin/PostgreSQL_bin ./bin/initdb -D $PROJECT_HOME/db_data/postgre_s30

./bin/postgres -D $PROJECT_HOME/db_data/postgre_s30 -p 54322 &

./bin/createdb -O {YOUR_USERNAME} dbt3 -p 54322 ./bin/psql -p 54322 -d dbt3 -f $PROJECT_HOME/mariadb-tools/dbt3_benchmark/dbt3_mysql/make-dbt3-db_pg.sql

./bin/pg_ctl -D $PROJECT_HOME/db_data/postgre_s30/ -p 54322 stop

cd $PROJECT_HOME/bin/mariadb-5.3.x-beta-linux-x86_64

./scripts/mysql_install_db --datadir=$PROJECT_HOME/db_data/dbt3_results_db

./bin/mysqld_safe --defaults-file=$PROJECT_HOME/mariadb-tools/dbt3_benchmark/config/results_mariadb_my.cnf --port=12340 --socket=$PROJECT_HOME/temp/mysql_results.sock --datadir=$PROJECT_HOME/db_data/dbt3_results_db/ &

./bin/mysql -u root -P 12340 -S $PROJECT_HOME/temp/mysql_results.sock < $PROJECT_HOME/mariadb-tools/dbt3_benchmark/dbt3_mysql/make-results-db.sql

./bin/mysqladmin --user=root --port=12340 --socket=$PROJECT_HOME/temp/mysql_results.sock shutdown 0

[common] RESULTS_DB_CONFIG = $PROJECT_HOME/mariadb-tools/dbt3_benchmark/tests/results_db_conf/results_db.conf TEST_CONFIG = $PROJECT_HOME/mariadb-tools/dbt3_benchmark/tests/test_conf/test_myisam.conf

[mariadb_5_3] QUERIES_CONFIG = $PROJECT_HOME/mariadb-tools/dbt3_benchmark/tests/queries_conf/queries.conf DB_CONFIG = $PROJECT_HOME/mariadb-tools/dbt3_benchmark/tests/db_conf/db_mariadb_5_3_myisam.conf

[mysql_5_5] QUERIES_CONFIG = $PROJECT_HOME/mariadb-tools/dbt3_benchmark/tests/queries_conf/queries_mysql.conf DB_CONFIG = $PROJECT_HOME/mariadb-tools/dbt3_benchmark/tests/db_conf/db_mysql_5_5_myisam.conf ...

unlink /path/to/datadir/mysql ln -s /path/to/value/in/MYSQL_SYSTEM_DIR/mysql_mariadb_5_3 /path/to/datadir/mysql

[db_settings] DBMS_HOME = $PROJECT_HOME/bin/mariadb-5.3.2-beta-linux-x86_64 DBMS_USER = root ...

QUERIES_AT_ONCE = 0 CLEAR_CACHES = 1 WARMUP = 0 ...

[queries_settings] QUERIES_HOME = /path/to/queries

[query1] QUERY=1.sql EXPLAIN_QUERY=1_explain.sql STARTUP_PARAMS=

[query2] QUERY=2.sql EXPLAIN_QUERY=2_explain.sql STARTUP_PARAMS=--optimizer_switch='mrr=on' --mrr_buffer_size=8M --some_startup_parmas ...

DBMS_HOME = $PROJECT_HOME/mariadb-5.3.x-beta-linux-x86_64 DBMS_USER = root ...

sudo /sbin/sysctl vm.drop_caches=3

{your_username} ALL=NOPASSWD:/sbin/sysctl

sar -u 0 2>null

sar -b 0 2>null

sar -r 0 2>null

perl launcher.pl --project-home=/path/to/project/home/ --results-output-dir=/path/to/project/home/results/myisam_test --datadir=/path/to/project/home/db_data/ --test=/path/to/project/home/mariadb-tools/dbt3_benchmark/tests/myisam_test_mariadb_5_3_mysql_5_5_mysql_5_6.conf --queries-home=/path/to/project/home/gen_query/ --scale-factor=30 --TIMEOUT=600

perl launcher.pl --project-home=/path/to/project/home/ --results-output-dir=/path/to/project/home/results/innodb_test --datadir=/path/to/project/home/db_data/ --test=/path/to/project/home/mariadb-tools/dbt3_benchmark/tests/innodb_test_mariadb_5_3_mysql_5_5_mysql_5_6.conf --queries-home=/path/to/project/home/gen_query/ --scale-factor=30 --TIMEOUT=7200 --NUM_TESTS=3

[mariadb_5_3_new_configuration] QUERIES_CONFIG = $PROJECT_HOME/mariadb-tools/dbt3_benchmark/tests/queries_conf/queries-mariadb.conf DB_CONFIG = $PROJECT_HOME/mariadb-tools/dbt3_benchmark/tests/db_conf/db_mariadb_5_3_myisam_new_configuration.conf

Last updated

Was this helpful?