1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14.

Sunday, October 11, 2009

XML Based Database Stress Test Tool

If you refer to this link, you will see an xml file containing example configuration information for a little tool I have been writing in Java. The aim of this is to stress test databases by executing SQL statements concurrently using Java threads. The xml file may seem vaguely reminiscent of an iBatis xml SQL maps, however my tool's configuration document contains information specific to tuning. Connections to the database are provided by a connection factory class, they can be: via a thin or thick JDBC driver (with or without use of the Oracle database resident connection pool) or use connection pooling, facilitated by the Oracle Universal Connection Pool. The code is largely complete, however, before I put it into the public domain, I want it to be pristine in terms of good coding practise, design and documentation. One of my colleagues at work has reviewed it , and its not in bad shape, the only problem being that my class model for storing SQL objects is not very OO, at present as I use one SQL statement class containing logic to work out how the execute method should be performed, i.e.:-
  • A stored procedure, function or package call will require the use of JDBC callable statement.
  • A select statement will return a result set, where as a DML statement will not.
The xml file allows the user to specify whether dml statements are to be run using JDBC batching or whether oracle.sql.ARRAY is to be used to perform array processing. Also, in order t to simulate the effect of hard parsing, the code can force this by putting randomly generated numbers in query hint text, dependant on whether value binding is set to soft or hard.

Hence, I'm in the process of modifying the code to use a Java interface for the SQL Statement class, with separate implementation classes for callable statements, DML statements and select statements, these will be created by a SQL statement factory class depending on what the xml file contains. Once this work is complete, I will update my blog and publish the source code via google doc links.

No comments:

 
1. 2.