Apache JDO Project - JIRA JDO-53

This is Interesting: Free IT Magazines  
Home > Archive > Apache JDO Project > June 2005 > JIRA JDO-53





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author JIRA JDO-53
Michael Watzek

2005-06-06, 7:50 am

Hi Andy,

JIRA JDO-53 suggests to use JPOX connection pooling to improve TCK
performance.

I followed the instructions decribed in
"http://www.jpox.org/docs/1_1/rdbms_connection_pooling.html" and ran
JPOX 1.1.0-beta-3 with commons-dbcp. To me, it looks like there is no
performance improvement executing the TCK.

So maybe, I made a mistake and you can help. This is what I have done:

1) Downloaded JPOX plugin for commons-dbcp (jpox-dbcp-1.1.0-beta-3.jar)
2) Downloaded commons-dbcp (commons-dbcp-1.2.1.jar)
3) Downloaded commons-pool (commons-pool-1.2.jar)
4) Downloaded commons-collections (commons-collections-3.1.jar)
5) Added a JPOX property to PMF properties
(org.jpox.connectionPoolingType=DBCP)
6) Added all jars to the classpath and started the TCK

Is there anything missing?

Please note that each TCK test has the following pattern:

pmf = JDOHelper.getPersistenceManagerFactory(..);
....
pmf.close();

Does PMF.close invalidate or clear the connection pool?

Regards,
Michael
--
-------------------------------------------------------------------
Michael Watzek Tech@Spree Engineering GmbH
mailto:mwa.tech@spree.de Buelowstr. 66
Tel.: ++49/30/235 520 36 10783 Berlin - Germany
Fax.: ++49/30/217 520 12 http://www.spree.de/
-------------------------------------------------------------------

Andy Jefferson

2005-06-06, 7:50 am

Hi Michael,

> This is what I have done:
>
> 1) Downloaded JPOX plugin for commons-dbcp (jpox-dbcp-1.1.0-beta-3.jar)
> 2) Downloaded commons-dbcp (commons-dbcp-1.2.1.jar)
> 3) Downloaded commons-pool (commons-pool-1.2.jar)
> 4) Downloaded commons-collections (commons-collections-3.1.jar)
> 5) Added a JPOX property to PMF properties
> (org.jpox.connectionPoolingType=DBCP)
> 6) Added all jars to the classpath and started the TCK
>
> Is there anything missing?


Sounds about right. Have you looked in the log to see if it has recognised
your connection pool setting ? (there is a block of messages printed when you
open the PMF and it should say something like "Datastore Connection Pooling :
DBCP")

> Please note that each TCK test has the following pattern:
>
> pmf = JDOHelper.getPersistenceManagerFactory(..);
> ...
> pmf.close();
>
> Does PMF.close invalidate or clear the connection pool?


In your case JPOX will be creating a DBCP DataSource, instead of the normal
DataSource, and in PMF.close() this is nulled out. Looking at the code it
isn't explicitly closed - I'll have to check if the DBCP class provides a
close() method.


--
Andy
JPOX - Java Persistent Objects

Michael Watzek

2005-06-06, 7:50 am

Hi Andy,

> In your case JPOX will be creating a DBCP DataSource, instead of the normal
> DataSource, and in PMF.close() this is nulled out. Looking at the code it
> isn't explicitly closed - I'll have to check if the DBCP class provides a
> close() method.

I'm just curious if two created PMF instances share the same connection
pool?

Regards,
Michael
--
-------------------------------------------------------------------
Michael Watzek Tech@Spree Engineering GmbH
mailto:mwa.tech@spree.de Buelowstr. 66
Tel.: ++49/30/235 520 36 10783 Berlin - Germany
Fax.: ++49/30/217 520 12 http://www.spree.de/
-------------------------------------------------------------------

Michael Watzek

2005-06-06, 7:50 am

Hi Andy,

>
>
> Sounds about right. Have you looked in the log to see if it has recognised
> your connection pool setting ? (there is a block of messages printed when you
> open the PMF and it should say something like "Datastore Connection Pooling :
> DBCP")

The JPOX log file does neither contain the strings "Datastore Connection
Pooling" nor "DBCP". Do I have to run JPOX on a particular log level? To
me, it looks like we run JPOX on "DEBUG".

I have tried to set the JPOX property "org.jpox.connectionPoolingType"
to "None". I get the exception below. I do not get this exception when I
set the property to "DBCP" or "C3P0". I also tried to exclude
commons-dbcp from the classpath. I got a ClassNotFoundException. So I
think, that connection pooling is used.

Regards,
Michael

javax.jdo.JDOUserException: Invalid Connection Pooling type. Please
check your specified type against the supported types in the JPOX
documentation, please specify the DataSource directly
at
org.jpox.PMFConfiguration. setConnectionPoolingType(PMFConfiguratio
n.java:962)
at
org.jpox.PersistenceManagerFactoryImpl$37.set(PersistenceManagerFactoryImpl.java:362)
at
org.jpox.PersistenceManagerFactoryImpl. setOptions(PersistenceManagerFactoryImpl
.java:619)
at
org.jpox.PersistenceManagerFactoryImpl. getPersistenceManagerFactory(Persistence
ManagerFactoryImpl.java:83)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:299)
at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:254)
at org.apache.jdo.tck.JDO_Test.getPMF(JDO_Test.java:386)
at org.apache.jdo.tck.JDO_Test.setUp(JDO_Test.java:163)
at org.apache.jdo.tck.JDO_Test.runBare(JDO_Test.java:180)
at org.apache.jdo.tck.util.BatchTestRunner.run(BatchTestRunner.java:75)
at org.apache.jdo.tck.util.BatchTestRunner.run(BatchTestRunner.java:70)
at
org.apache.jdo.tck.api.persistencemanagerfactory.AfterCloseSetMethodsThrowException.main(AfterCloseSetMethodsThrowException.java:62)

--
-------------------------------------------------------------------
Michael Watzek Tech@Spree Engineering GmbH
mailto:mwa.tech@spree.de Buelowstr. 66
Tel.: ++49/30/235 520 36 10783 Berlin - Germany
Fax.: ++49/30/217 520 12 http://www.spree.de/
-------------------------------------------------------------------

Andy Jefferson

2005-06-06, 7:50 am

> The JPOX log file does neither contain the strings "Datastore Connection
> Pooling" nor "DBCP". Do I have to run JPOX on a particular log level? To
> me, it looks like we run JPOX on "DEBUG".


You need the log4j category "log4j.category.JPOX.JDO" set at DEBUG level to
see these.

> I have tried to set the JPOX property "org.jpox.connectionPoolingType"
> to "None". I get the exception below.


That is fixed in CVS, but is not important since you could just omit the
setting if you don't want connection pooling.

> I also tried to exclude commons-dbcp from the classpath. I got a
> ClassNotFoundException. So I think, that connection pooling is used.


That is a reasonable assumption. The log would confirm it - and DBCP probably
has log categories that can be enabled to see the gory details of its pooling
process if you really need to know.
Always gives significant speed ups for me. Really depends on the test and
whether you do more than 1 or 2 txns or DB calls in a test.

--
Andy
JPOX - Java Persistent Objects

Andy Jefferson

2005-06-06, 7:50 am

> > In your case JPOX will be creating a DBCP DataSource, instead of the
>
> I'm just curious if two created PMF instances share the same connection
> pool?


No.
You create a PMF and it gets its own (DBCP/C3P0/...) DataSource, and hence it
gets its own connection pool (unless DBCP/C3P0 are intelligent enough to
realise when 2 PMF connection URLs and login credentials are the same and so
share with the already existing data source ...)

--
Andy
JPOX - Java Persistent Objects

Michael Watzek

2005-06-06, 7:50 am

Hi Andy,

>
>
> No.
> You create a PMF and it gets its own (DBCP/C3P0/...) DataSource, and hence it
> gets its own connection pool (unless DBCP/C3P0 are intelligent enough to
> realise when 2 PMF connection URLs and login credentials are the same and so
> share with the already existing data source ...)

This is very likely the reason why I do not see performance improvement
in TCK runs: Many tests execute only 1 transaction and each test uses a
separate PMF instance.

Thanks,
Michael
--
-------------------------------------------------------------------
Michael Watzek Tech@Spree Engineering GmbH
mailto:mwa.tech@spree.de Buelowstr. 66
Tel.: ++49/30/235 520 36 10783 Berlin - Germany
Fax.: ++49/30/217 520 12 http://www.spree.de/
-------------------------------------------------------------------

Craig Russell

2005-06-06, 7:50 am

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com