|
This chapter describes how to use TG in the command line mode. It assumes that you have already installed TG in the "C:\tg07X" 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 parameter fileld
<SYSTEM
EDITOR = C:\WINNT\system32\notepad.exe
PROMPT = TG
AUTOEXEC = off
SPOOL = off
>
######## agent and database parameter field
<DATABASE
DRIVERTYPE = thin
HOSTNAME = 192.168.1.100
PORT = 1521
SIDNAME = R920
TNSNAMES = R920
USERNAME = test
PASSWORD = test
SESSIONS = 10
THINKTIME = 300
>
######## variable parameter field
<VARIABLE
VARIABLE_NAME = :NDATA
VARIABLE_TYPE = NUMBER
VARIABLE_PROP = 1..1000000
>
<VARIABLE
VARIABLE_NAME = :CDATA
VARIABLE_TYPE = CHARACTER
VARIABLE_PROP = 1..255
>
<VARIABLE
VARIABLE_NAME = :DATE
VARIABLE_TYPE = DATE
VARIABLE_PROP = 2000/01/01..2010/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 parameter field
<TRANSACTION
AVERAGE = 80
STATEMENT = select * from test where id = :NDATA;
>
<TRANSACTION
AVERAGE = 10
STATEMENT = insert into test values
(idseq.nextval,:NDATA,to_date(:DATE,'YYYY/MM/DD'),:CDATA);
STATEMENT = commit;
>
<TRANSACTION
AVERAGE = 5
STATEMENT = select ndata from test where id = :NDATA for update;
STATEMENT = update test
set cdata = :MONTH
where id = :NDATA;
STATEMENT = commit;
>
<TRANSACTION
AVERAGE = 5
STATEMENT = delete from test where id = :NDATA;
STATEMENT = rollback;
>
|
|
| |
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 tg07X
C:\tg07X> tg
TG - Transaction Generator - [ Version 0.70 ] Sun Dec 03 01:37:38 JST 2006
Loading configration file... OK.
Registered transactions:2 , variables:2 , jobs:4 , slave servers:0
Loading Oracle JDBC driver... 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 config
-- AGENT CONFIGURATION ---------------------------------
DriverType : thin
Hostname : 192.168.1.100
Port : 1521
SIDName : R920
Username : test
Password : test
Sessions : 10
Thinktime : 300 ms
Execution_Count : unlimited
Delay_Start : false
Error_Retry_Count : 5
Error_Retry_Wait : 10000 ms
Error_Reconnect_Count : 5
Error_Reconnect_Wait : 10000 ms
Connect_URL : jdbc:oracle:thin:@192.168.1.100:1521:R920
TG>
|
|
| |
| |
※ COMMAND-LINE SAMPLE
|
TG> show variables
-- VARIABLE CONFIGURATION ------------------------------
Registerd Variables Total : 5
Variable No : 1
Variable name : :NDATA
Variable type : NUMBER
Variable range : 1..1000000
Variable No : 2
Variable name : :CDATA
Variable type : CHARACTER
Variable range : 1..255
Variable No : 3
Variable name : :DATE
Variable type : DATE
Variable range : 2000/01/01..2010/12/31
Variable No : 4
Variable name : :MONTH
Variable type : LIST
Variable range : 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 trans
-- TRANSACTION CONFIGURATION ---------------------------
Registerd Transactions Total : 4
Transaction No : 1
Average : 80/100
SQL No.1 : select * from test where id = :NDATA
Transaction No : 2
Average : 10/100
SQL No.1 : insert into test values (idseq.nextval,:NDATA,to_date(:DATE,'YYYY/MM/DD'),:CDATA)
SQL No.2 : commit
Transaction No : 3
Average : 5/100
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
Average : 5/100
SQL No.1 : delete from test where id = :NDATA
SQL No.2 : rollback
TG> |
|
| |
  |
|
Step4 |
- Connection test - |
                                  |
Usign "CHECK CONFIG" command, you can test a current configuration. |
| |
※ COMMAND-LINE SAMPLE
|
TG> check config
Now checking to connect database... OK.
Using Oracle JDBC Driver Version : 9.2.0.1.0
Tried URL : jdbc:oracle:thin:@192.168.1.100:1521:R920
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:37 AgS:ACTV Act:50/50 SES:45/50 ErD:0/50 ERR:0 TPS:0
04:22:38 AgS:ACTV Act:50/50 SES:50/50 ErD:0/50 ERR:0 TPS:0
Monitoring start : Tue May 09 04:22:31 JST 2006
Monitoring end : Tue May 09 04:22:38 JST 2006
Average TPS : 0.0 (Total transaction count : 0 / monitoring time : 6)
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. |
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>
|
|
| |
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.43 ] Sat Feb 05 03:20:57 JST 2005
C:\tg070>
|
|
| |
|