Re: prepared statement pooling MySQL

2009-06-22 Thread Michael Dick
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=xxx,
 password=xxx,
 maxActive=100,
 maxIdle=100,
 initialSize=100,
 poolPreparedStatements=true/

 property name=openjpa.ConnectionDriverName
 value=org.apache.commons.dbcp.BasicDataSource/

 Best regards
 Georgi



Re: prepared statement pooling MySQL

2009-06-22 Thread Georgi Naplatanov

Hi Michael

here is the log, look at the end of file
http://os.oles.biz/opencms/jpa-driver/tmp/jpa-trace.log.tar.gz

The application use traditional join syntax

property name=openjpa.jdbc.DBDictionary 
value=JoinSyntax=traditional, SupportsUniqueConstraints=false/


Best regards
Georgi

Michael Dick wrote:

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=xxx,
password=xxx,
maxActive=100,
maxIdle=100,
initialSize=100,
poolPreparedStatements=true/

property name=openjpa.ConnectionDriverName
value=org.apache.commons.dbcp.BasicDataSource/

Best regards
Georgi