{"id":980,"date":"2021-05-07T15:04:37","date_gmt":"2021-05-07T15:04:37","guid":{"rendered":"https:\/\/www.hammerdb.com\/blog\/?p=980"},"modified":"2021-05-10T14:09:37","modified_gmt":"2021-05-10T14:09:37","slug":"hammerdb-v4-1-cli-transaction-counter-and-count-logging","status":"publish","type":"post","link":"https:\/\/www.hammerdb.com\/blog\/uncategorized\/hammerdb-v4-1-cli-transaction-counter-and-count-logging\/","title":{"rendered":"HammerDB v4.1 New Features Pt2: CLI Transaction Counter and Count Logging"},"content":{"rendered":"<p>Prior to v4.1 HammerDB has featured a graphical transaction counter, this enables you to see the transaction rate taking place on the database during the test. The transaction counter is designed not to be intrusive on the schema being tested. It also enables you to verify that the transaction rate reported at the end of the test is consistent throughout without peaks and troughs in the graph that would indicate bottlenecks due to configuration issues.<\/p>\n<figure id=\"attachment_983\" aria-describedby=\"caption-attachment-983\" style=\"width: 815px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/www.hammerdb.com\/blog\/wp-content\/uploads\/2021\/05\/oltc.png\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-983 size-full\" src=\"https:\/\/www.hammerdb.com\/blog\/wp-content\/uploads\/2021\/05\/oltc.png\" alt=\"\" width=\"815\" height=\"676\" srcset=\"https:\/\/www.hammerdb.com\/blog\/wp-content\/uploads\/2021\/05\/oltc.png 815w, https:\/\/www.hammerdb.com\/blog\/wp-content\/uploads\/2021\/05\/oltc-300x249.png 300w, https:\/\/www.hammerdb.com\/blog\/wp-content\/uploads\/2021\/05\/oltc-768x637.png 768w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/a><figcaption id=\"caption-attachment-983\" class=\"wp-caption-text\">GUI Transaction Counter<\/figcaption><\/figure>\n<p>From v4.1 HammerDB also features a transaction counter in the CLI.\u00a0 Similarly to the GUI transaction counter the CLI one also runs in a separate thread to be non-intrusive to main workload. To configure the CLI transaction counter use the tcset command with the same options available in the GUI. The transaction counter can then be started with tcstart, stopped with tcstop and queried with tcstatus.<\/p>\n<pre>hammerdb&gt;help tcset\r\ntcset - Usage: tcset [refreshrate|logtotemp|unique|timestamps]\r\nConfigure the transaction counter options. Equivalent to the Transaction Counter Options window in the graphical interface.\r\n\r\nhammerdb&gt;help tcstart\r\ntcstart - Usage: tcstart\r\nStarts the Transaction Counter.\r\n\r\nhammerdb&gt;help tcstatus\r\nstatus - Usage: tcstatus\r\nChecks the status of the Transaction Counter.\r\n\r\nhammerdb&gt;help tcstop\r\ntcstop - Usage: tcstop\r\nStops the Transaction Counter.<\/pre>\n<p>An example test script is shown including the transaction counter commands.<\/p>\n<pre>dbset db mssqls\r\ndiset connection mssqls_server {(local)\\SQLDEVELOP}\r\ndiset tpcc mssqls_driver timed\r\ndiset tpcc mssqls_rampup 1\r\ndiset tpcc mssqls_duration 2\r\nvuset logtotemp 1\r\ntcset logtotemp 1\r\ntcset timestamps 1\r\nloadscript\r\nvuset vu 2\r\nvucreate\r\ntcstart\r\ntcstatus\r\nvurun\r\nruntimer 200\r\nvudestroy\r\ntcstop<\/pre>\n<p>When we run the script we have now activated the transaction counter to run throughout the test.<\/p>\n<pre>hammerdb&gt;source sqlrun.tcl\r\nDatabase set to MSSQLServer\r\nChanged connection:mssqls_server from (local) to (local)\\SQLDEVELOP for MSSQLServer\r\nClearing Script, reload script to activate new setting\r\nScript cleared\r\nChanged tpcc:mssqls_driver from test to timed for MSSQLServer\r\nChanged tpcc:mssqls_rampup from 2 to 1 for MSSQLServer\r\nChanged tpcc:mssqls_duration from 5 to 2 for MSSQLServer\r\nTransaction Counter log to temp set to 1\r\nTransaction Counter timestamps set to 1\r\nScript loaded, Type \"print script\" to view\r\nVuser 1 created MONITOR - WAIT IDLE\r\nVuser 2 created - WAIT IDLE\r\nVuser 3 created - WAIT IDLE\r\nVuser 4 created - WAIT IDLE\r\nVuser 5 created - WAIT IDLE\r\nLogging activated\r\nto C:\/Users\/Steve\/AppData\/Local\/Temp\/hammerdb.log\r\n5 Virtual Users Created with Monitor VU\r\nTransaction Counter logging activated to C:\/Users\/Steve\/AppData\/Local\/Temp\/hdbtcount.log\r\nTransaction Counter Started\r\nTransaction Counter thread running with threadid:tid0000000000002F88\r\nVuser 1:RUNNING\r\n0 MSSQLServer tpm\r\nVuser 1:Beginning rampup time of 1 minutes\r\nVuser 2:RUNNING\r\nVuser 2:Processing 1000000 transactions with output suppressed...\r\nVuser 3:RUNNING\r\nVuser 3:Processing 1000000 transactions with output suppressed...\r\nVuser 4:RUNNING\r\nVuser 4:Processing 1000000 transactions with output suppressed...\r\nVuser 5:RUNNING\r\nVuser 5:Processing 1000000 transactions with output suppressed...\r\n238182 MSSQLServer tpm\r\n261366 MSSQLServer tpm\r\n251310 MSSQLServer tpm\r\n255102 MSSQLServer tpm\r\n252180 MSSQLServer tpm\r\nVuser 1:Rampup 1 minutes complete ...\r\nVuser 1:Rampup complete, Taking start Transaction Count.\r\nVuser 1:Timing test period of 2 in minutes\r\n228408 MSSQLServer tpm\r\nTimer: 1 minutes elapsed\r\n267666 MSSQLServer tpm\r\n248466 MSSQLServer tpm\r\n283332 MSSQLServer tpm\r\n270900 MSSQLServer tpm\r\n242988 MSSQLServer tpm\r\nVuser 1:1 ...,\r\n246384 MSSQLServer tpm\r\nTimer: 2 minutes elapsed\r\n255042 MSSQLServer tpm\r\n275712 MSSQLServer tpm\r\n260112 MSSQLServer tpm\r\n258246 MSSQLServer tpm\r\n243798 MSSQLServer tpm\r\nVuser 1:2 ...,\r\nVuser 1:Test complete, Taking end Transaction Count.\r\nVuser 1:4 Active Virtual Users configured\r\nVuser 1:TEST RESULT : System achieved 112009 NOPM from 257938 SQL Server TPM\r\nVuser 1:FINISHED SUCCESS\r\nVuser 3:FINISHED SUCCESS\r\nVuser 2:FINISHED SUCCESS\r\nVuser 5:FINISHED SUCCESS\r\nVuser 4:FINISHED SUCCESS\r\nALL VIRTUAL USERS COMPLETE\r\nruntimer returned after 178 seconds\r\n235392 MSSQLServer tpm\r\nvudestroy success\r\nTransaction Counter thread running with threadid:tid0000000000002F88\r\nStopping Transaction Counter\r\nClosed Transaction Counter Log<\/pre>\n<p>It should also be noted that we now have the option to record the output of the transaction counter to a new log file called hdbtcount.log. We also have the option of giving this file a unique log name and adding timestamps to each line of output.\u00a0 The following shows the contents in the logfile from the previous test.<\/p>\n<pre>Hammerdb Transaction Counter Log @ Fri May 07 15:31:33 BST 2021\r\n+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r\n0 MSSQLServer tpm @ Fri May 07 15:31:33 BST 2021\r\n238182 MSSQLServer tpm @ Fri May 07 15:31:43 BST 2021\r\n261366 MSSQLServer tpm @ Fri May 07 15:31:53 BST 2021\r\n251310 MSSQLServer tpm @ Fri May 07 15:32:03 BST 2021\r\n255102 MSSQLServer tpm @ Fri May 07 15:32:13 BST 2021\r\n252180 MSSQLServer tpm @ Fri May 07 15:32:23 BST 2021\r\n228408 MSSQLServer tpm @ Fri May 07 15:32:33 BST 2021\r\n267666 MSSQLServer tpm @ Fri May 07 15:32:43 BST 2021\r\n248466 MSSQLServer tpm @ Fri May 07 15:32:53 BST 2021\r\n283332 MSSQLServer tpm @ Fri May 07 15:33:04 BST 2021\r\n270900 MSSQLServer tpm @ Fri May 07 15:33:14 BST 2021\r\n242988 MSSQLServer tpm @ Fri May 07 15:33:24 BST 2021\r\n246384 MSSQLServer tpm @ Fri May 07 15:33:34 BST 2021\r\n255042 MSSQLServer tpm @ Fri May 07 15:33:44 BST 2021\r\n275712 MSSQLServer tpm @ Fri May 07 15:33:54 BST 2021\r\n260112 MSSQLServer tpm @ Fri May 07 15:34:04 BST 2021\r\n258246 MSSQLServer tpm @ Fri May 07 15:34:14 BST 2021\r\n243798 MSSQLServer tpm @ Fri May 07 15:34:24 BST 2021\r\n235392 MSSQLServer tpm @ Fri May 07 15:34:34 BST 2021<\/pre>\n<p>This option to record the transaction counter output is not only available in the CLI, it has also been added to the GUI with a checkbox option of Log Output to Temp with the same additional options as the CLI to use a unique log name and add timestamps.<\/p>\n<figure id=\"attachment_988\" aria-describedby=\"caption-attachment-988\" style=\"width: 349px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/www.hammerdb.com\/blog\/wp-content\/uploads\/2021\/05\/tcountopt2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-988 size-full\" src=\"https:\/\/www.hammerdb.com\/blog\/wp-content\/uploads\/2021\/05\/tcountopt2.png\" alt=\"\" width=\"349\" height=\"404\" srcset=\"https:\/\/www.hammerdb.com\/blog\/wp-content\/uploads\/2021\/05\/tcountopt2.png 349w, https:\/\/www.hammerdb.com\/blog\/wp-content\/uploads\/2021\/05\/tcountopt2-259x300.png 259w\" sizes=\"auto, (max-width: 349px) 100vw, 349px\" \/><\/a><figcaption id=\"caption-attachment-988\" class=\"wp-caption-text\">GUI Log Transaction Counter<\/figcaption><\/figure>\n<p>Adding the Transaction Counter to the CLI and Transaction Counter Logging to both GUI and CLI enables you to record the transaction rate during the test to ensure that the rates are consistent throughout the test without significant variance around your test result.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Prior to v4.1 HammerDB has featured a graphical transaction counter, this enables you to see the transaction rate taking place on the database during the test. The transaction counter is designed not to be intrusive on the schema being tested. It also enables you to verify that the transaction rate reported at the end of &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.hammerdb.com\/blog\/uncategorized\/hammerdb-v4-1-cli-transaction-counter-and-count-logging\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;HammerDB v4.1 New Features Pt2: CLI Transaction Counter and Count Logging&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"ppma_author":[5],"class_list":["post-980","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"authors":[{"term_id":5,"user_id":2,"is_guest":0,"slug":"hammerdb","display_name":"HammerDB","avatar_url":{"url":"https:\/\/www.hammerdb.com\/blog\/wp-content\/uploads\/2018\/10\/logo-white.png","url2x":"https:\/\/www.hammerdb.com\/blog\/wp-content\/uploads\/2018\/10\/logo-white.png"},"author_category":"","user_url":"http:\/\/www.hammerdb.com","last_name":"","first_name":"","job_title":"","description":""}],"_links":{"self":[{"href":"https:\/\/www.hammerdb.com\/blog\/wp-json\/wp\/v2\/posts\/980","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hammerdb.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hammerdb.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hammerdb.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hammerdb.com\/blog\/wp-json\/wp\/v2\/comments?post=980"}],"version-history":[{"count":9,"href":"https:\/\/www.hammerdb.com\/blog\/wp-json\/wp\/v2\/posts\/980\/revisions"}],"predecessor-version":[{"id":1006,"href":"https:\/\/www.hammerdb.com\/blog\/wp-json\/wp\/v2\/posts\/980\/revisions\/1006"}],"wp:attachment":[{"href":"https:\/\/www.hammerdb.com\/blog\/wp-json\/wp\/v2\/media?parent=980"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hammerdb.com\/blog\/wp-json\/wp\/v2\/categories?post=980"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hammerdb.com\/blog\/wp-json\/wp\/v2\/tags?post=980"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.hammerdb.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=980"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}