db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Armin Waibel <arm...@apache.org>
Subject PreparedStatement caching
Date Sat, 23 Apr 2005 17:12:59 GMT
Hi all,

I stumble across a performance issue when the sql-driver doesn't support 
caching of PreparedStatements or doesn't work very well.

When running the 'perf-test' target against maxDB I got the following 
result:
[ojb] ================================================================
[ojb]         OJB PERFORMANCE TEST SUMMARY
[ojb] 12 concurrent threads, handle 500 objects per thread
[ojb]         - performance mode - results per thread
[ojb] ================================================================
[ojb]      API  Period   Total   Total  Insert   Fetch  Update  Delete
[ojb]            [sec]   [sec]     [%]  [msec]  [msec]  [msec]  [msec]
[ojb] ----------------------------------------------------------------
[ojb]     JDBC   9.927   7.544     100    5392      68    1490     593
[ojb]     ODMG  22.958  16.831     223    9595     325    4131    2779
[ojb]       PB  22.127   17.16     227   10511     120    3776    2753
[ojb]      OTM  40.804  32.639     433   23024     225    5056    4332
[ojb] ================================================================

You can see that all OJB API don't perform very well compared with plain 
JDBC (PB is 120% slower!!). The problem is that OJB use for each object 
a new PS instead reusing the old one.

I wrote a StatementCache and run this test again
[ojb] ================================================================
[ojb]         OJB PERFORMANCE TEST SUMMARY
[ojb] 12 concurrent threads, handle 500 objects per thread
[ojb]         - performance mode - results per thread
[ojb] ================================================================
[ojb]      API  Period   Total   Total  Insert   Fetch  Update  Delete
[ojb]            [sec]   [sec]     [%]  [msec]  [msec]  [msec]  [msec]
[ojb] ----------------------------------------------------------------
[ojb]     JDBC  10.083   8.248     100    5517      72    1652    1006
[ojb]     ODMG   14.89  11.044     134    6764     366    2318    1595
[ojb]       PB  13.948   11.22     136    7305     215    1997    1701
[ojb]      OTM  22.872  17.597     213   12787     308    2435    2066
[ojb] ================================================================

Now it's totally different. The PB, ODMG API are only 35% slower than 
plain JDBC. The statement cache boost performance.

Is it reasonable to include a new configurable feature 
"statementCaching=on/off" in 1.0.x and 1.x or should always the 
jdbc-driver or connection-pool do such things?

regards,
Armin

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message