Hi,
a friend of mine and I are writing our master thesis at RWTH Aachen (Germany). We are to write an ORM Benchmark for open source ORM (such as Hibernate 3) and we have a severe problem with c3p0 pool beeing multithreaded. The alternative of using Hibernate's built in connection pool is not an option due to it's poor performance...
System overview
Maybe I'll start with a little overview of our benchmark. Our system simulates a multi-user environment on a server. Each user is modeled via a single Thread (!) that queries the ORM (we call each such Thread, representing a user in our system, an AccessPattern).
The main task of our logging mechanism is the following: for each query of an AccessPattern, log the ORM response time, and distinguish the response time of any resulting calls to the DB, i.e. we want to seperately log time spent in the ORM and time spent in the DB for each AccessPattern! Therefore for each query, we have to associate every resulting DB query to the actual call to the ORM method that invoked the call to the DB. Like for instance if we call session.beginTransaction(), we have to associate the resulting DB call getAutoCommit() to the former call to the ORM. Furthermore, our logging mechanism has to be non-invasive, i.e. no sourcecode changes in the ORM allowed. Therefore our approach was to use a wrapper for the ORM and a wrapper for the JDBC driver.
The Problem
The c3p0 connection pool, the connection pool of choice for hibernate, keeps it's connections in seperate Threads (ThreadPoolAsynchronousRunner). We have yet to find a way to associate an ORM query of an AccessPattern (remember: each AP is run in a seperate Thread) to the resulting DB calls, which will be carried out in a sperate Thread of the pool.
With Hibernate's built in connection pool this is quite easy to do, but with c3p0 we have yet to find a solution... Maybe the Proxool would be an alternative as well, but I have not yet been able to get it running with Hibernate 3... Any ideas how we can associate the resulting DB queries of an AccessPattern's call to the ORM with that same call?
Many thanks in advance for your input,
Sincerely
Firat Alagöz