Home skin

 

  Location : TOP > Usage
> Command-line mode
 
     
  Step1 Edit the "tg.conf" configration file
Step2 Startup TG
Step3 Verify the configuration
Step4 Connection test
Step5 Create sessions
Step6 Start transactions
Step7 Terminate TG
 
     
  >> TOP  
 
   

 

 

 

 

 

 

 

 

 

This chapter describes how to use TG in the command line mode. It assumes that you have already installed TG in the "C:\tg08X" directory.

 

  Step1 - Edit the "tg.conf" configration file -

In the begining, Edit the "tg.conf" configration file and set the target database informationon and random variables, transactions, etc...

 
* SAMPLE "tg.conf"

######## Sample configration file for TG
#### System Field.
<SYSTEM
EDITOR= notepad.exe
PROMPT= TG
AUTOEXEC= off
SPOOL= off
>

#### Database Field.
<DATABASE
JDBC_DRIVER= ORACLE
DRIVER_TYPE = THIN
HOSTNAME= dbsrv01
PORT= 1521
SID_NAME= testdb
>

#### Agent Field.
<AGENT
USERNAME= test
PASSWORD= test
SESSIONS= 50
THINKTIME= 200
>

#### Variable Field.
<VARIABLE
VARIABLE_NAME = :NDATA
VARIABLE_TYPE = NUMBER
VARIABLE_PROP = 1..1000000
>

<VARIABLE
VARIABLE_NAME = :CDATA
VARIABLE_TYPE = CHARACTER
VARIABLE_PROP = 128..255
>

<VARIABLE
VARIABLE_NAME = :DDATA
VARIABLE_TYPE = DATE
VARIABLE_PROP = 2000/01/01..2002/12/31
>

<VARIABLE
VARIABLE_NAME = :MONTH
VARIABLE_TYPE = LIST
VARIABLE_PROP = "January", "February", "March", "April", "May", "June",
"July" , "August" , "September","October", "November", "December"
>

<VARIABLE
VARIABLE_NAME = :ID
VARIABLE_TYPE = AGENTID
>

#### Transaction Field.
<TRANSACTION
TRANS_NAME = SELECT0
AVERAGE= 80
STATEMENT= select * from test where id = :NDATA;
>

<TRANSACTION
TRANS_NAME = INSERT0
AVERAGE= 10
STATEMENT= insert into test values
(idseq.nextval,:NDATA,to_date(:DDATA,'YYYY/MM/DD'),:CDATA);
STATEMENT= commit;
>

<TRANSACTION
TRANS_NAME= UPDATE0
AVERAGE= 5
STATEMENT= select ndata from test where id = :NDATA for update;
STATEMENT= update test
set cdata = :MONTH
where id = :NDATA;
STATEMENT = commit;
>

<TRANSACTION
TRANS_NAME = DELETE0
AVERAGE= 5
STATEMENT= delete from test where id = :NDATA;
STATEMENT= rollback;
>

#### Job Field.
<JOB
JOB_NAME = EXEC_STATSPACK
JOB_TYPE = TELNET
HOSTNAME = 192.168.100.100
PORT = 23
USERNAME = oracle
PASSWORD = oracle
EXECFILE = $TGSCRIPT0.tgs
>

 

 

  Step2 - Startup TG -

Run "tg.bat" startup script from the command prompt. TG will load the "tg.conf" configration file and execute self initilaization.

 
* COMMAND-LINE SAMPLE
C:\> cd tg08X
C:\tg08X> tg

TG - Transaction Generator - [ Version 0.8X ] Sat Jun 16 14:24:42 JST 2007

Loading configuration file... OK.
Registered transactions:4 , variables:5 , jobs:1 , slave servers:0

Loading JDBC driver "oracle.jdbc.driver.OracleDriver" ... OK.

type "HELP" or "h" to print help messages.

TG>
 

In the example of the above, four transactions and five random variables are registered.

 

  Step3 - Verify the configuration -

Using "SHOW" command, you can verify each configuration.

 
* COMMAND-LINE SAMPLE
TG> show database
-- DATABASE CONFIGURATION -----------------------------
JDBC_DRIVER: ORACLE
DRIVER_TYPE: thin
HOSTNAME: dbsrv01
PORT: 1521
SID_NAME: testdb
DRIVER_CLASS: oracle.jdbc.driver.OracleDriver
JDBC_URL: jdbc:oracle:thin:@192.168.100.100:1521:testdb

TG>
 

 

 
* COMMAND-LINE SAMPLE

TG> show config agent
-- AGENT CONFIGURATION --------------------------------
USERNAME : test
PASSWORD : test
AGENT_LOGON_OPTION: normal
SESSIONS : 50
THINKTIME : 200 ms
EXECUTION_COUNT: unlimited
DELAY_START: false
ERROR_RETRY_COUNT: 5 times
ERROR_RETRY_WAIT: 1000 ms
ERROR_RECONNECT_COUNT: 5 times
ERROR_RECONNECT_WAIT: 10000 ms
AUTO_COMMIT : false
ISOLATION_LEVEL: default
SHOW_RESULTSET_ROWS: 5 rows
SHOW_STMT_BEFORE_EXEC : false

TG>

 

 

 
* COMMAND-LINE SAMPLE

TG> show config variables
-- VARIABLE CONFIGURATION -----------------------------
Registerd Variables Total : 5
VARIABLE No : 1
VARIABLE_NAME : :NDATA
VARIABLE_TYPE : NUMBER
VARIABLE_PROP : 1..1000000
VARIABLE No : 2
VARIABLE_NAME : :CDATA
VARIABLE_TYPE : CHARACTER
VARIABLE_PROP : 128..255
VARIABLE No : 3
VARIABLE_NAME : :DDATA
VARIABLE_TYPE : DATE
VARIABLE_PROP : 2000/01/01..2002/12/31
VARIABLE No : 4
VARIABLE_NAME : :MONTH
VARIABLE_TYPE : LIST
VALUES : January, February, March, April, May, June, July, August, September, October, November, December
VARIABLE No : 5
VARIABLE_NAME : :ID
VARIABLE_TYPE : AGENTID

TG>

 

 

 
* COMMAND-LINE SAMPLE
TG> show config transactions
-- TRANSACTION CONFIGRATION ---------------------------
Registerd Transactions Total : 4
TRANSACTION No : 1
TRANS_NAME : SELECT0
AVERAGE : 80
SQL No.1 : select * from test where id = :NDATA
TRANSACTION No : 2
TRANS_NAME : INSERT0
AVERAGE : 10
SQL No.1 : insert into test values (idseq.nextval,:NDATA,to_date(:DDATA,'YYYY/MM/DD'),:CDATA)
SQL No.2 : commit
TRANSACTION No : 3
TRANS_NAME : UPDATE0
AVERAGE : 5
SQL No.1 : select ndata from test where id = :NDATA for update
SQL No.2 : update test set cdata = :MONTH where id = :NDATA
SQL No.3 : commit
TRANSACTION No : 4
TRANS_NAME : DELETE0
AVERAGE : 5
SQL No.1 : delete from test where id = :NDATA
SQL No.2 : rollback

TG>
 

 

 
* COMMAND-LINE SAMPLE

TG> show config jobs
-- JOB CONFIGURATION ----------------------------------
Registerd Jobs Total : 1
JOB No : 1
JOB_NAME: EXEC_STATSPACK
JOB_TYPE: TELNET
TRIGGER :
IMPORT_DB_PARAMETERS : false
HOSTNAME: 192.168.100.100
PORT: 23
USERNAME: oracle
PASSWORD: oracle
EXECFILE: C:\tg080\jobs\$TGSCRIPT0.tgs

TG>

 

 

  Step4 - Connection test -

Usign "CHECK CONFIG" command, you can test a current configuration.

 
* COMMAND-LINE SAMPLE

TG> check config
Using driver class : oracle.jdbc.driver.OracleDriver
Tring URL: jdbc:oracle:thin:@192.168.100.100:1521:testdb
USERNAME : test
PASSWORD : test
LOGON_OPTION
Now checking to connect to the database... OK.

Driver information
~~~~~~~~~~~~~~~~~~
- Driver name: Oracle JDBC driver
- Product name: Oracle
- Product version : 10.2.0.2.0

TG>

 

 

  Step5 - Create sessions -

Using "CONNECT" command, make agents connect to the target database.

 
* COMMAND-LINE SAMPLE

TG> connect
Make agents connect to the target database.
TG>

 

 

Using "MONITOR" command, you can confirm current session status.

 
* COMMAND-LINE SAMPLE

TG> monitor
Monitoring start. hit ENTER Key to end monitoring.
23:09:43 TRGT:WAIT CONN:14/50 DISC:36/50 TERM:0/50 ERR:0 TPS:0
23:09:44 TRGT:WAIT CONN:21/50 DISC:29/50 TERM:0/50 ERR:0 TPS:0
23:09:45 TRGT:WAIT CONN:28/50 DISC:22/50 TERM:0/50 ERR:0 TPS:0
23:09:46 TRGT:WAIT CONN:35/50 DISC:15/50 TERM:0/50 ERR:0 TPS:0
23:09:47 TRGT:WAIT CONN:42/50 DISC:8/50 TERM:0/50 ERR:0 TPS:0
23:09:48 TRGT:WAIT CONN:49/50 DISC:1/50 TERM:0/50 ERR:0 TPS:0
23:09:49 TRGT:WAIT CONN:50/50 DISC:0/50 TERM:0/50 ERR:0 TPS:0
23:09:50 TRGT:WAIT CONN:50/50 DISC:0/50 TERM:0/50 ERR:0 TPS:0

<- Hit RETURN-Key here to finish the monitoring.

---- TRANSACTION REPORT ( SUMMARY ) ------------------

MONITORING PERIOD
~~~~~~~~~~~~~~~~~
- Begin : Sat May 08 23:09:43 JST 2008
- End: Sat May 08 23:09:50 JST 2008

THROUGHPUT
~~~~~~~~~~
Transaction name MinMax Average
================ === === =======
SELECT0- --
INSERT0- --
UPDATE0- --
DELETE0- --

TPS
~~~
- Total transaction count : 0
- Monitoring time: 8 seconds
- Average TPS: 0.00

TG>

 

 

  Step6 - Start transactions -

Using "START" command, change agent's status into "ACTIVE" mode.

 
* COMMAND-LINE SAMPLE

TG> start
Activate Agents.
TG>

 

 

Using "MONITOR" command, You can confirm the current transaction statistics.

 
* COMMAND-LINE SAMPLE

TG> monitor
Monitoring start. hit ENTER Key to end monitoring.
23:15:18 TRGT:ACTV CONN:50/50 DISC:0/50 TERM:0/50 ERR:0 TPS:90
23:15:19 TRGT:ACTV CONN:50/50 DISC:0/50 TERM:0/50 ERR:0 TPS:97
23:15:20 TRGT:ACTV CONN:50/50 DISC:0/50 TERM:0/50 ERR:0 TPS:94
23:15:21 TRGT:ACTV CONN:50/50 DISC:0/50 TERM:0/50 ERR:0 TPS:100
23:15:22 TRGT:ACTV CONN:50/50 DISC:0/50 TERM:0/50 ERR:0 TPS:96
23:15:23 TRGT:ACTV CONN:50/50 DISC:0/50 TERM:0/50 ERR:0 TPS:95
23:15:24 TRGT:ACTV CONN:50/50 DISC:0/50 TERM:0/50 ERR:0 TPS:94
23:15:25 TRGT:ACTV CONN:50/50 DISC:0/50 TERM:0/50 ERR:0 TPS:100


( * * * * snip * * * * )

23:25:51 TRGT:ACTV CONN:50/50 DISC:0/50 TERM:0/50 ERR:0 TPS:93
23:25:52 TRGT:ACTV CONN:50/50 DISC:0/50 TERM:0/50 ERR:0 TPS:97
23:25:53 TRGT:ACTV CONN:50/50 DISC:0/50 TERM:0/50 ERR:0 TPS:98

<- Hit RETURN-Key here to finish the monitoring.

---- TRANSACTION REPORT ( SUMMARY ) ------------------

MONITORING PERIOD
~~~~~~~~~~~~~~~~~
- Begin : Sun May 08 23:15:18 JST 2008
- End: Sun May 08 23:25:53 JST 2008

THROUGHPUT
~~~~~~~~~~
Transaction name MinMax Average
================ === ====== =======
SELECT0 0ms337ms 1.65ms
INSERT00ms724ms 10.13ms
UPDATE00ms170ms 3.33ms
DELETE00ms339ms 1.66ms

TPS
~~~
- Total transaction count : 62116
- Monitoring time: 636 seconds
- Average TPS: 97.67

TG>

 

 

Using "VERBOSE" command, you can look at the actual agents processing. Executing SQL statements, getting results of the query, etc... Input "verbose on" to start verbose mode, and "verbose off" to finish it.
* To short, "v on" and "v off" are available too.

 
* COMMAND-LINE SAMPLE

TG> verbose on
enable verbose output : All agents
23:30:48 AgentID:14 RN:99 TN:4 MESG: ******** Transaction started. ******
23:30:48 AgentID:14 RN:99 TN:4 STMT: delete from test where id = ?
23:30:48 AgentID:14 RN:99 TN:4 STMT: setint=:NDATA (VALNo:1) [VAL:553165]
23:30:48 AgentID:14 RN:99 TN:4 STMT: execstmt
23:30:48 AgentID:14 RN:99 TN:4 STMT: rollback
23:30:48 AgentID:14 RN:99 TN:4 MESG: Elapsed time : 1 msec.
23:30:48 AgentID:14 RN:99 TN:4 MESG: ******** Transaction completed. ****
23:30:48 AgentID:14 MESG: Now thinking for 500 msec
23:30:48 AgentID:45 RN:12 TN:1 MESG: ******** Transaction started. ******
23:30:48 AgentID:45 RN:12 TN:1 STMT: select * from test where id = ?
23:30:48 AgentID:45 RN:12 TN:1 STMT: setint=:NDATA (VALNo:1) [VAL:61083]
23:30:48 AgentID:45 RN:12 TN:1 STMT: execstmt
23:30:48 AgentID:45 RN:12 TN:1 RSLT:
23:30:48 AgentID:45 RN:12 TN:1 MESG: Elapsed time : 1 msec.
23:30:48 AgentID:45 RN:12 TN:1 MESG: ******** Transaction completed. ****
23:30:48 AgentID:45 MESG: Now thinking for 500 msec

disable verbose output : All agents
TG>

 

 

When you stop the transaction temporary, use "STOP" command. To restart the transaction, issue "START" command again.

 
* COMMAND-LINE SAMPLE

TG> stop
Freeze Agents.
TG>

 

 

  Step7 - Terminate TG -

Issue "DISCONNECT" command to make agents disconnect from the target database.

 
* COMMAND-LINE SAMPLE

TG> disconnect
Make agents disconnect from the target database.
TG>

 

 

Use "EXIT" command and terminate TG.

 
* COMMAND-LINE SAMPLE

TG> exit
bye.
TG - Transaction Generator - [ Version 0.8X ] Thu May 05 23:36:14 JST 2008
C:\tg080>

 

 

     
   >> TOP > Usage
> Command-line mode
 

 

 

 
 

 

 
 
Copyright 2003 - 2009 tgmstr. All rights reserved.