TPC-Council / HammerDB

HammerDB Database Load Testing and Benchmarking Tool
http://www.hammerdb.com
GNU General Public License v3.0
542 stars 115 forks source link

Add CPU metrics to CLI, jobs and automate start #704

Closed sm-shaw closed 1 month ago

sm-shaw commented 1 month ago

Is your feature request related to a problem? Please describe. Currently, the CPU metrics is run by starting a remote agent that reports a port i.e. agent id and then connect the display. This can take longer than needed. Also there is no CPU metrics feature in the CLI.

Describe the solution you'd like It would be an improvement to enable setting the agent id so we know in advance, automating the start of the agent if run on the localhost and to add metrics data to the CLI. It would also be beneficial to allow recording and charting metrics when a job is run.

Describe alternatives you've considered It should still be possible to run an agent manually for when the database is on another system for where HammerDB is running by installing an additional agent.

Additional context It will still be possible to run an agent manually, however if HammerDB and the database being tested are on the same system, we can have an option to start both together.

met1

met9

We then get the agent and display to start together.

met2 met3

For Oracle and PostgreSQL the CPU display is shown embedded in the database metrics met9

We can add metset, metstart, metstatus and metstop commands

#!/bin/tclsh
# maintainer: Pooja Jain

set tmpdir $::env(TMP)
puts "SETTING CONFIGURATION"
dbset db mssqls
dbset bm TPC-C

diset connection mssqls_tcp false
diset connection mssqls_port 1433
diset connection mssqls_azure false
diset connection mssqls_encrypt_connection true
diset connection mssqls_trust_server_cert true
diset connection mssqls_authentication windows
diset connection mssqls_server {(local)\SQLEXPRESS}

diset tpcc mssqls_dbase tpcc
diset tpcc mssqls_driver timed
diset tpcc mssqls_total_iterations 10000000
diset tpcc mssqls_rampup 1
diset tpcc mssqls_duration 2
diset tpcc mssqls_checkpoint false
diset tpcc mssqls_timeprofile true
diset tpcc mssqls_allwarehouse true

loadscript
puts "TEST STARTED"
vuset vu vcpu
vucreate
metstart
tcstart
set jobid [ vurun ]
vudestroy
tcstop
metstop
puts "TEST COMPLETE"
set of [ open $tmpdir/mssqls_tprocc w ]
puts $of $jobid
close $o

When metrics are run, we have additional job output for system and metrics

met5

eg system shows the following:

met7

and metrics

met8 met6

For the CLI when metrics are started it reports output as follows:

Connecting to Agent to Display CPU Metrics
Metric receive port open @ 11732 on yellowhammer
Connecting to HammerDB Agent @ localhost:10000
Testing Agent Connectivity...OK
Metrics Connected
Started CPU Metrics for Intel(R) Core(TM) i5-1035G7 CPU @ 1.20GHz:(8 CPUs)
233352 MSSQLServer tpm
CPU all usr%-23.85 sys%-3.03 irq%-0.00 idle%-71.33
369714 MSSQLServer tpm
CPU all usr%-24.85 sys%-2.36 irq%-0.00 idle%-72.65
383484 MSSQLServer tpm
CPU all usr%-24.67 sys%-2.31 irq%-0.00 idle%-72.81
337770 MSSQLServer tpm
CPU all usr%-0.00 sys%-1.97 irq%-0.00 idle%-81.31
211182 MSSQLServer tpm
CPU all usr%-24.03 sys%-2.21 irq%-0.00 idle%-73.24
Vuser 1:Rampup 1 minutes complete ...
Vuser 1:Rampup complete, Taking start Transaction Count.
Vuser 1:Timing test period of 2 in minutes
293148 MSSQLServer tpm
CPU all usr%-22.90 sys%-2.65 irq%-0.00 idle%-72.83
259614 MSSQLServer tpm
CPU all usr%-45.36 sys%-8.97 irq%-0.58 idle%-41.59
241854 MSSQLServer tpm
CPU all usr%-18.19 sys%-2.73 irq%-0.29 idle%-77.61
280578 MSSQLServer tpm
CPU all usr%-23.01 sys%-3.04 irq%-0.00 idle%-73.33
221520 MSSQLServer tpm
CPU all usr%-20.61 sys%-2.75 irq%-0.31 idle%-75.22
221610 MSSQLServer tpm
CPU all usr%-24.43 sys%-3.30 irq%-0.00 idle%-71.92
Vuser 1:1 ...,
189894 MSSQLServer tpm
CPU all usr%-4.46 sys%-1.28 irq%-0.00 idle%-86.20
193962 MSSQLServer tpm
CPU all usr%-20.12 sys%-3.19 irq%-0.44 idle%-76.33
200604 MSSQLServer tpm
CPU all usr%-18.80 sys%-2.49 irq%-0.00 idle%-76.88
240342 MSSQLServer tpm
CPU all usr%-16.95 sys%-1.83 irq%-0.11 idle%-80.77
235584 MSSQLServer tpm
CPU all usr%-18.14 sys%-2.56 irq%-0.00 idle%-78.80
240912 MSSQLServer tpm
CPU all usr%-19.13 sys%-2.49 irq%-0.00 idle%-77.52
223194 MSSQLServer tpm