Sunday, July 6, 2008

How to develop own transactions load with Swingbench

Swingbench is a free tool to generate load on database. This product has four benchmark and you can test those benchmark easily. Almost no extra work needed. Just import schema tablespaces and load data and test load with predefined transaction.

But how you can test load with your transaction based on your data?

While configuring swingbench you may have troubles to load your own defined transaction into it and then test your load. In this topic I will write how easily you can proceed with swingbench to test load with your defined transaction.

With swingbench to test your own defined transaction there are two approaches. Either by writing PL/SQL procedures or by writing JAVA programs. The steps are discussed below using stored procedures.

1. Unzip swingbench product.
2. Open the file $SWINGHONE/sql/storedprocedures.sql with an vi editor and edit the procedures. There are six stored procedures by defaults. You can add more if you wish. For example here I have edited storedprocedure3 to add a delete statement like below.

function storedprocedure3(min_sleep integer, max_sleep integer) return integer_return_array is
begin
init_dml_array();
execute immediate 'DELETE FROM TEST where name= ''1''';
increment_deletes(1);
sleep(min_sleep, max_sleep);
return dml_array;
end storedprocedure3;


3. In this way you can add several procedures like insert , update, delete etc. and save the file. Like save it as stored.sql
4. Log on to the user on which you want to test load and then execute the script. For example,
SQL>conn arju/a
SQL>@stored.sql

A typical output is,
SQL> @/export/home/oracle/stored.sql

Type created.


Package created.


Package body created.

If you get any error then try to fix the error.

5.Now edit the $SWINGHONE/bin/swingconfig.xml file and along with username, passowrd etc entry edit the transaction entry to include the StoredProceduren class where n may be from 1 to ... as you ran script in to your database. Like here I added storedprocedure4 in the configuration file.

[Transaction]
[Id]UpdateCount[/Id]
[ShortName]Update Count Table[/ShortName] [ClassName]com.dom.benchmarking.swingbench.storedprocedures.
StoredProcedure4[/ClassName]
[Weight]20[/Weight]
[Enabled]true[/Enabled]
[/Transaction]

Use <> instead of [].

Along with class name you can edit ID and shortname for better understanding.

6. Now save the swingconfig.xml file and run the swingbench. If you have syntactically correct in your swingconfig.xml swingbench will run and test your load.

7.You can edit the configuration as your wish. You can give different load in the configuration tab.

Related Documents:

Automatic Load Generation tool in Database
Swingbench Exception: Oracle jdbc classes not found

No comments:

Post a Comment