Hi Georgi,

It's hard to say anything definitive without seeing the prepared statements
that are being pooled. We generate slightly different SQL for different
databases, and depending on your app it might not lend itself well to
pooling with MySQL.

Could you enable openjpa SQL tracing to see which statements are being
generated? Just add the following property to persistence.xml  :

<property name="openjpa.Log" value="SQL=TRACE"/> <!-- logs to system.err -->
or
<property name="openjpa.Log" value="SQL=TRACE,File=/home/mike/sql.log.txt"/>
<!-- logs to /home/mike/sql.log.txt -->

When you see the SQL it might explain why pooling doesn't seem to help..

-mike


On Mon, Jun 22, 2009 at 6:35 AM, Georgi Naplatanov <go...@oles.biz> wrote:

> Hello list
>
> I use OpenJPA with Apache DBCP in Java SE environment.
>
> My problem is the performance when prepared statement pooling is enabled in
> DBCP -  it is the same as when statement pooling is disabled.
>
> My question is - why prepared statement pooling does not increase
> performance on MySQL ?
>
> BTW I made the same test with PostgreSQL and performance is better when
> prepared statement pooling is enabled.
>
> I use MySQL 5.0.51a and OpenJPA 1.2.0
>
> it is the database configuration in my persistence.xml file.
>
> <property name="openjpa.ConnectionProperties"
> value="driverClassName=com.mysql.jdbc.Driver,
> url=jdbc:mysql://localhost:3306/cms8?characterEncoding=UTF-8,
> username=xxxxxxx,
> password=xxxxxxx,
> maxActive=100,
> maxIdle=100,
> initialSize=100,
> poolPreparedStatements=true"/>
>
> <property name="openjpa.ConnectionDriverName"
> value="org.apache.commons.dbcp.BasicDataSource"/>
>
> Best regards
> Georgi
>

Reply via email to