Shiva Kumar
Shiva Kumar

Reputation: 3161

How to test performance of java DBMS application

Here is my scenario:

I have a java application that reads data from a table T1 of database D1, processes it and puts it in another table T2 of another database D2. This happens real time, i.e., as and when a record is inserted or updated in table T1, the application will pick the data, process it and pushes it to the destination table. I wish to monitor performance of this application using a testing(preferrably JUnit) and/or performance framework. In my test case I wish to have following

The tests that I wish to create should be

So, my question is, what is the best way to test this kind of scenario? Are there any available tools that will help me achieve this?

Upvotes: 1

Views: 1107

Answers (1)

Renat Gilmanov
Renat Gilmanov

Reputation: 17895

Database agnostic

In order to achieve that I would suggest to use simplest possible SQL and some low-level JDBC abstraction layer:

DBUtils

The Commons DbUtils library is a small set of classes designed to make working with JDBC easier. JDBC resource cleanup code is mundane, error prone work so these classes abstract out all of the cleanup tasks from your code leaving you with what you really wanted to do with JDBC in the first place: query and update data.

MyBatis

MyBatis is a first class persistence framework with support for custom SQL, stored procedures and advanced mappings. MyBatis eliminates almost all of the JDBC code and manual setting of parameters and retrieval of results. MyBatis can use simple XML or Annotations for configuration and map primitives, Map interfaces and Java POJOs (Plain Old Java Objects) to database records.

Both will do the trick for you. With good attention to details you'll manage to provide flexible enough solution and test as many databases as you want.

Provide results that can show trends and be configurable with a CI tool like Jenkins

Define several KPIs and make sure you can get all values periodically. For example you can measure a throughput (records per second). Export data periodically (as CSV or properties for example) and use PlotPlugin for visualization:

enter image description here

You can also check relevant question: How do I plot benchmark data in a Jenkins matrix project

Proper testing

Please make sure your testing strategy is well defined and you will not miss anything:

  1. Load testing
  2. Stress testing

Upvotes: 1

Related Questions