diff --git a/README.md b/README.md index 9f9ad06..5ada2a5 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,376 @@ -# hammerdb -Wrapper scripts for running HammerDB automatically. These wrappers scripts may -be run from zathras or manually. +# HammerDB (Database Performance) Benchmark Wrapper -Underlying workload: https://github.com/TPC-Council/HammerDB +## Description -Benchmark description: HammerDB is the leading benchmarking and load testing software for the worlds most popular databases supporting Oracle Database, Microsoft SQL Server, IBM Db2, PostgreSQL, MySQL and MariaDB. +This wrapper facilitates the automated execution of the HammerDB database benchmark. HammerDB is the leading benchmarking and load testing software for the world's most popular databases. It implements TPC-C style OLTP workloads to measure database transaction throughput in Transactions Per Minute (TPM). + +The wrapper provides: +- Automated HammerDB installation and execution. +- Support for three database engines: MariaDB, PostgreSQL, and Microsoft SQL Server. +- Automatic database installation, configuration, and schema build. +- Automatic LVM volume and filesystem creation for database storage. +- Optional separate log disk support for database write-ahead logs. +- Configurable user (connection) count scaling. +- Configurable warehouse count for database sizing. +- Support for local and remote (multi-host) database deployments. +- Automatic memory-based buffer pool sizing. +- Result collection, processing, and verification. +- CSV and JSON output formats. +- System configuration metadata capture. +- Integration with test_tools framework. +- Optional Performance Co-Pilot (PCP) integration. + +For more information see: https://github.com/TPC-Council/HammerDB + +## Command-Line Options + +``` +HammerDB Options: + --disks : Comma-separated list of disk devices to use for database storage. + Special value "grab_disks" auto-detects all unmounted disks. + Required. + --filesys : Filesystem type to create on the disk devices. Default: xfs. + --log_disks : Comma-separated list of disk devices for database log storage. + Creates a separate LVM volume and filesystem mounted at /perf2. + Optional; if not specified, logs are stored on the main data filesystem. + --sub_test : Database engine to test. Required. + Supported values: mariadb, mssql, postgres. + --users : Comma-separated list of user (connection) counts to test. + Default: 10,20,40. + --warehouses : Number of TPC-C warehouses to build in the database. + Default: 1000 for MariaDB, 500 for PostgreSQL and MSSQL. + --usage: Display this usage message. + +General test_tools options: + --debug: Enable bash -x debug output for wrapper troubleshooting. + --home_parent : Parent home directory. If not set, defaults to current working directory. + --host_config : Host configuration name, defaults to current hostname. + --iterations : Number of times to run the test, defaults to 1. + --json_skip: Skip JSON conversion of test CSV results. + --no_pkg_install: Do not install any packages (system or pip). Useful for pre-provisioned systems. + --no_system_packages: Do not install system packages via the package manager. Pip packages are still installed. + --no_pip_packages: Do not install Python pip packages. System packages are still installed. + --run_label : Label to associate with the run. No default. + --run_user: User that is actually running the test on the test system. Defaults to current user. + --sys_type: Type of system working with (aws, azure, hostname). Defaults to hostname. + --sysname: Name of the system running, used in determining config files. Defaults to hostname. + --test_tools_release : Version tag of test_tools-wrappers to check out and use. + --tuned_setting: Used in naming the results directory. For RHEL, defaults to current active tuned profile. + For non-RHEL systems, defaults to 'none'. If set to a profile name, activates that tuned profile. + --use_pcp: Enable Performance Co-Pilot monitoring during test execution. + --verify_skip: Skip result verification against the Pydantic schema. + --tools_git : Git repo to retrieve the required tools from. + Default: https://github.com/redhat-performance/test_tools-wrappers + --usage: Display this usage message. +``` + +## What the Script Does + +The wrapper consists of two scripts: `hammerdb` (entry point) and `run_hammerdb` (core test runner). Together they perform the following workflow: + +1. **Environment Setup**: + - Disables SELinux (`setenforce 0`) for the duration of the test. + - Clones the test_tools-wrappers repository if not present (default: ~/test_tools). + - Sources error codes and general setup utilities. + - Gathers hardware information via `gather_data`. + - Unsets the `DISPLAY` variable (HammerDB CLI mode requires no display). + +2. **Package Installation**: + - Installs base dependencies via package_tool using `hammerdb.json` (lvm2, sysstat, bc, git, zip, unzip). + - Installs database-specific packages based on `--sub_test`: + - **MariaDB**: mariadb, mariadb-common, mariadb-errmsg, mariadb-server, mariadb-server-utils (from `hammerdb_mariadb.json`). + - **PostgreSQL**: postgresql, postgresql-contrib, postgresql-server, glibc-langpack-en, libpq (from `hammerdb_postgres.json`). + - **MSSQL**: installed from Microsoft repositories via the `install-script`. + - Package definitions are currently defined for RHEL only. + +3. **Storage Setup**: + - Creates an LVM volume group and logical volume from the specified disks. + - Creates a filesystem (default: XFS) on the logical volume. + - Mounts the filesystem at `/perf1` for database data storage. + - Optionally creates a separate LVM volume and filesystem at `/perf2` for database logs when `--log_disks` is specified. + - Supports `grab_disks` for auto-detecting unmounted disks. + +4. **Tuned Profile**: + - If `--tuned_setting` is specified and not "none", records the current active profile, then switches to the requested profile. + - Restores the original profile after the test completes. + +5. **HammerDB Installation**: + - The `install-script` downloads the official HammerDB 3.2 Linux x86-64 installer directly from the [TPC-Council HammerDB GitHub releases](https://github.com/TPC-Council/HammerDB/releases/download/v3.2/HammerDB-3.2-Linux-x86-64-Install) — no manual upload or kit archive is required. + - Runs the non-interactive installer into a working directory (`hammerdb/hammerdb-tpcc/Hammerdb`) under the repo checkout. + - Copies the database-specific TCL scripts and config files already included in this repo, from `hammerdb_scripts//` (build and run scripts for MariaDB, PostgreSQL, and MSSQL). + - For remote deployments: copies `install-script` to each remote host via SCP and executes it remotely. + +6. **Database Installation and Configuration**: + - **MariaDB**: + - Installs MariaDB packages. + - Configures data directory on `/perf1/mysql/data` and log directory. + - Auto-sizes `innodb_buffer_pool_size` to half of system memory (capped at 64000 MiB). + - Sets root password and restarts the service. + - **PostgreSQL**: + - Installs PostgreSQL packages. + - Runs `postgresql-setup initdb` with data on `/perf1/postgres_data`. + - Moves `pg_wal` to the log filesystem for write-ahead log separation. + - Auto-sizes `shared_buffers` to half of system memory (capped at 64000 MiB). + - Sets postgres user password and restarts the service. + - **MSSQL**: + - Installs MSSQL Server from Microsoft repositories. + - Configures data directory on `/perf1/mssql_data`. + - Runs initial setup with evaluation license. + - Creates the database and configures temp mount points. + +7. **Schema Build**: + - Drops any existing `tpcc` database. + - Runs the HammerDB build TCL script (`build_.tcl`) to create and populate the TPC-C schema. + - The schema is sized according to the warehouse count. + - For remote hosts: runs the build script on each host in parallel via SSH, then waits for all to complete. + +8. **Test Execution**: + - Iterates over the configured user counts (default: 10, 20, 40). + - For each user count: + - Copies and modifies the run TCL script (`runtest_.tcl`) to set the user count and host. + - Executes `hammerdbcli auto