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

Persist VU settings across restarts #696

Closed v1k1nghawk closed 2 months ago

v1k1nghawk commented 2 months ago

Automatically update the VU generic settings inside the vuset command (CLI) and inside the Virtual User Options (GUI) to make it easier to persist VU settings across restarts. Write the values to SQLite storage when set or the user presses OK.

Example of the new vuset (CLI) behavior across the restarts:

$ ./hammerdbcli
HammerDB CLI v4.10
Copyright (C) 2003-2024 Steve Shaw
Type "help" for a list of commands
Initialized Jobs on-disk database /tmp/hammer.DB using existing tables (335,872 KB)
hammerdb>vurun
Script loaded, Type "print script" to view
Vuser 1 created MONITOR - WAIT IDLE
Vuser 2 created - WAIT IDLE
Vuser 3 created - WAIT IDLE
Vuser 4 created - WAIT IDLE
Vuser 5 created - WAIT IDLE
5 Virtual Users Created with Monitor VU
...
hammerdb>print generic
Generic Dictionary Settings
...
virtual_user_options {
 virtual_users   = 4
 user_delay      = 500
 repeat_delay    = 500
 iterations      = 1
 show_output     = 1
 log_to_temp     = 0
 unique_log_name = 0
 no_log_buffer   = 0
 log_timestamps  = 0
}
...
hammerdb>vudestroy
vudestroy success

hammerdb>vuset vu 7

hammerdb>vucreate
Vuser 1 created MONITOR - WAIT IDLE
Vuser 2 created - WAIT IDLE
Vuser 3 created - WAIT IDLE
Vuser 4 created - WAIT IDLE
Vuser 5 created - WAIT IDLE
Vuser 6 created - WAIT IDLE
Vuser 7 created - WAIT IDLE
Vuser 8 created - WAIT IDLE
8 Virtual Users Created with Monitor VU

hammerdb>exit
$ ./hammerdbcli
HammerDB CLI v4.10
Copyright (C) 2003-2024 Steve Shaw
Type "help" for a list of commands
Initialized Jobs on-disk database /tmp/hammer.DB using existing tables (335,872 KB)
hammerdb>vurun
Script loaded, Type "print script" to view
Vuser 1 created MONITOR - WAIT IDLE
Vuser 2 created - WAIT IDLE
Vuser 3 created - WAIT IDLE
Vuser 4 created - WAIT IDLE
Vuser 5 created - WAIT IDLE
Vuser 6 created - WAIT IDLE
Vuser 7 created - WAIT IDLE
Vuser 8 created - WAIT IDLE
8 Virtual Users Created with Monitor VU
...
hammerdb>print generic
Generic Dictionary Settings
...
virtual_user_options {
 virtual_users   = 7
 user_delay      = 500
 repeat_delay    = 500
 iterations      = 1
 show_output     = 1
 log_to_temp     = 0
 unique_log_name = 0
 no_log_buffer   = 0
 log_timestamps  = 0
}
...

Virtual Users Options menu (GUI) is the same before and after the restart: image

sm-shaw commented 2 months ago

Many thanks for the pull request, I will take a look and review as soon as time allows.

sm-shaw commented 2 months ago

I've done a quick overview and some changes are needed, for the GUI it makes more sense to update the entire dict rather than every value with a single command and for the cli the command updates the SQLite data to persist over restarts but does not update the dict so if you do print generic after doing vuset it still shows the old value. I will do a commit to the PR that corrects these and then it should be good.