File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Performance and the fly likes Database monitoring Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Performance
Bookmark "Database monitoring" Watch "Database monitoring" New topic

Database monitoring

Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970

My JavaDB JDBC application is dog-slow (compared to the non-database application it's supposed to replace). I would like to analyse where all the time is going. The application is definitely disk-bound (disk light on permanently), not CPU-bound (utilisation ~10%), so I think traditional CPU profiling may not be very helpful.

Any suggestions for tools that can help? I have used JProbe and JProfiler in the past; licences have lapsed but could be renewed. But do they do wall-clock-timing or only CPU timing?

I looked briefly at Jamon, and it looked like it had some good features for JDBC applications. However, while it was clear how to add monitoring of a Connection, it wasn't at all clear how to get the monitored data out of Jamon! Any help there?

Lastly, any evidence that any other database is much faster (particularly with BLOBs) than JavaDB? Note that I have JavaDB embedded in the same JVM as the application, which would seem to give it a head-start over any DB in a separate process.
[ January 05, 2007: Message edited by: Peter Chase ]

Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
steve souza
Ranch Hand

Joined: Jun 26, 2002
Posts: 862
With jamon you can monitor your jdbc driver or Connection. Monitoring via the jdbc url is best as you don't have to change any code to get monitoring working.

1) via the jdbc driver. The example uses sybase but it will work for any jdbc driver

2)To monitor anything issued via the connection you could do the following. This works against any interface by the way.
import com.jamonapi.proxy.*;

Connection proxyConnection=MonProxyFactory.monitor(connection);

3) If your app runs in a web server/app server simply install the jamon.war to view the data. A live demo of this application is available at

4) If you don't have a web container then you can get at the data programattically in various ways. The easiest way to understand how is to look at jamonadmin.jsp that comes with the war.

However here is the raw data. This is the data you see in jamonadmin.jsp

String[] header=MonitorFactory.getHeader();
Object[][] data=MonitorFactory.getData(); - a fast, free open source performance tuning api.
JavaRanch Performance FAQ
Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
Thanks for this.

As it happens, though, I discovered that JProfiler would let me have a 10-day evaluation again and I found it very easy to profile my database application using that program. So easy, in fact, that I am hoping to get it bought for me!
Sushil Sharma

Joined: Nov 02, 2006
Posts: 22
I am not clear what you want to profile. The performance of system is tied to the database, and number and frequency of queries. Most databases including Oracle and MySql cache tables in the memory (this happens behind the scene).

From my experience there is not much difference, between databases, regarding queries and insertion. For some reason, accessing Blob is a problem. If your data is ASCII characters I would suggest using VARCHAR.
I agree. Here's the link:
subject: Database monitoring
It's not a secret anymore!