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= 192.168.100.100
PORT= 1521
SID_NAME= testdb
>

#### Agent Field.
<AGENT
USERNAME= test
PASSWORD= test
SESSIONS= 10
THINKTIME= 1000
>

#### 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.80 ] 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: 192.168.100.100
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 agent
-- AGENT CONFIGURATION --------------------------------
USERNAME : test
PASSWORD : test
SESSIONS : 10
THINKTIME : 1000 ms
EXECUTION_COUNT: unlimited
DELAY_START: false
ERROR_RETRY_COUNT: 5
ERROR_RETRY_WAIT: 1000 ms
ERROR_RECONNECT_COUNT: 5
ERROR_RECONNECT_WAIT: 10000 ms

TG>

 

 

 
* COMMAND-LINE SAMPLE

TG> show 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 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 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
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
Agents connecting to database.
TG>

 

 

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

 
* COMMAND-LINE SAMPLE

TG> monitor
Monitoring start. [ 600 Seconds ]
04:22:31 AgS:ACTV Act:50/50 SES:10/50 ErD:0/50 ERR:0 TPS:0
04:22:32 AgS:ACTV Act:50/50 SES:21/50 ErD:0/50 ERR:0 TPS:0
04:22:33 AgS:ACTV Act:50/50 SES:33/50 ErD:0/50 ERR:0 TPS:0
04:22:34 AgS:ACTV Act:50/50 SES:38/50 ErD:0/50 ERR:0 TPS:0
04:22:35 AgS:ACTV Act:50/50 SES:45/50 ErD:0/50 ERR:0 TPS:0

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

MONITORING PERIOD
~~~~~~~~~~~~~~~~~
- Begin : Sat Jun 16 04:22:31 JST 2007
- End: Sat Jun 16 04:22:35 JST 2007

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

TPS
~~~
- Total transaction count : 0
- Monitoring time: 5 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. [ 600 Seconds ]
01:54:12 AgS:ACTV Act:50/50 SES:50/50 ErD:0/50 ERR:0 TPS:96
01:54:13 AgS:ACTV Act:50/50 SES:50/50 ErD:0/50 ERR:0 TPS:52
01:54:14 AgS:ACTV Act:50/50 SES:50/50 ErD:0/50 ERR:0 TPS:118
01:54:15 AgS:ACTV Act:50/50 SES:50/50 ErD:0/50 ERR:0 TPS:84
01:54:16 AgS:ACTV Act:50/50 SES:50/50 ErD:0/50 ERR:0 TPS:187
01:54:17 AgS:ACTV Act:50/50 SES:50/50 ErD:0/50 ERR:0 TPS:84
01:54:18 AgS:ACTV Act:50/50 SES:50/50 ErD:0/50 ERR:0 TPS:101
01:54:19 AgS:ACTV Act:50/50 SES:50/50 ErD:0/50 ERR:0 TPS:106

( * * * * snip * * * * )

01:55:09 AgS:ACTV Act:50/50 SES:50/50 ErD:0/50 ERR:0 TPS:96
01:55:10 AgS:ACTV Act:50/50 SES:50/50 ErD:0/50 ERR:0 TPS:52
01:55:11 AgS:ACTV Act:50/50 SES:50/50 ErD:0/50 ERR:0 TPS:118
---- TRANSACTION REPORT ( SUMMARY ) ------------------

MONITORING PERIOD
~~~~~~~~~~~~~~~~~
- Begin : Sun Dec 10 01:54:12 JST 2006
- End: Sun Dec 10 01:55:11 JST 2006

THROUGHPUT
~~~~~~~~~~
Transaction name MinMax Average
================ === ====== =======
SELECT0 0ms683ms 19.31ms
INSERT00ms237ms 33.99ms
UPDATE00ms1173ms 32.65ms
DELETE00ms207ms 15.39ms

TPS
~~~
- Total transaction count : 11703
- Monitoring time: 600 seconds
- Average TPS: 19.50

TG>

 

 

Using "VERBOSE" command, you can look at the actual agents processing. Executing SQL statements, getting results of the query, etc... When you terminate the verbose-mode, enter "NORMAL" command.

 
* COMMAND-LINE SAMPLE

TG> verbose
enable verbose output.

Ag:4 Rand:2 TrNo:1 ATR:1 SQL: set=2 [:NAME0:r874k]
Ag:42 Rand:6 TrNo:1 ATR:1 SQL: insert into test values (?,?,?,?)
Ag:30 Rand:3 TrNo:1 ATR:1 SQL: insert into test values (?,?,?,?)
Ag:44 Rand:9 TrNo:1 ATR:1 SQL: exec
Ag:23 Rand:4 TrNo:1 ATR:1 SQL: set=2 [:NAME0:rAv8n0Cf4]
Ag:3 Rand:9 TrNo:1 ATR:1 SQL: set=2 [:NAME0:I3bhi]
Ag:31 Rand:4 TrNo:1 ATR:1 SQL: set=2 [:NAME0:uOyHY1]
Ag:26 Rand:9 TrNo:1 ATR:1 SQL: set=2 [:NAME0:8Cz]
Ag:34 Rand:8 TrNo:1 ATR:1 SQL: insert into test values (?,?,?,?)
Ag:8 Rand:2 TrNo:1 ATR:1 SQL: insert into test values (?,?,?,?)
Ag:12 Rand:1 TrNo:1 ATR:1 SQL: set=2 [:NAME0:xGgV]

stop verbose output.
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
Agents disconnecting from database.
TG>

 

 

Use "EXIT" command and terminate TG.

 
* COMMAND-LINE SAMPLE

TG> exit
bye.
TG - Transaction Generator - [ Version 0.80 ] Sat Feb 05 03:20:57 JST 2005
C:\tg080>

 

 

     
   >> TOP > Usage
> Command-line mode
 

 

Copyright 2003 - 2008 tgmstr. All rights reserved.