You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by ApolloX <sc...@selikoff.net> on 2008/02/21 18:06:35 UTC

EJB Entity Cache in Geronimo 2.1

Hi,

I'm using Geronimo 2.1, where exactly is the EJB entity cache configured
from within an application?  The openejb-jar.xml, persistence.xml,
ejb-jar.xml or some other location?

In my log file I have numerous repeated calls from Open EJB using the
findAll() methods.  It seems to be hitting the database multiple times for a
single table in a short period making me think there is no cache configured.

Thanks,
ApolloX
-- 
View this message in context: http://www.nabble.com/EJB-Entity-Cache-in-Geronimo-2.1-tp15614510s134p15614510.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.


Re: EJB Entity Cache in Geronimo 2.1

Posted by ApolloX <sc...@selikoff.net>.
I forgot to mention, I have code from G1.0 that is now running *EXTREMELY
SLOW* in G2.1.  With OpenEJB logging debug enabled, I'm seeing endless
repeated calls, such as:

12:00:00,000 DEBUG [OpenEJB] finished invoking method ... Return value ...

does that mean its connecting to the database everytime I see one of these
lines?  If so, it's thrashing on repeated database calls.  I'm seeing
hundreds of these calls for the same data over and over again in short
periods of time.

Any suggestions as to what could be configured wrong?

-ApolloX


ApolloX wrote:
> 
> Hi,
> 
> I'm using Geronimo 2.1, where exactly is the EJB entity cache configured
> from within an application?  The openejb-jar.xml, persistence.xml,
> ejb-jar.xml or some other location?
> 
> In my log file I have numerous repeated calls from Open EJB using the
> findAll() methods.  It seems to be hitting the database multiple times for
> a single table in a short period making me think there is no cache
> configured.
> 
> Thanks,
> ApolloX
> 

-- 
View this message in context: http://www.nabble.com/EJB-Entity-Cache-in-Geronimo-2.1-tp15614510s134p15619565.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.


Re: EJB Entity Cache in Geronimo 2.1

Posted by Jacek Laskowski <ja...@laskowski.net.pl>.
On Tue, Feb 26, 2008 at 6:41 PM, ApolloX <sc...@selikoff.net> wrote:

>  I don't think JPA is reading the persistence.xml for CMP2 beans.  I added
>  some parameters to and it ignored them.  Each time it deploys, it uses the
>  default broker.  Is there reason why this file might be ignored for CMP2
>  beans?

Hi,

Perhaps I don't really understand it, but could you try out putting
the persistence.xml file inside your geronimo plan as outlined in
http://cwiki.apache.org/GMOxSAMPLES/running-jboss-seam-200ga-on-geronimo-21.html.
See the The plan, esp. the part with persistence-unit name="cmp".

Jacek

-- 
Jacek Laskowski
http://www.JacekLaskowski.pl

Re: EJB Entity Cache in Geronimo 2.1

Posted by ApolloX <sc...@selikoff.net>.
Hi Jacek,

I don't think JPA is reading the persistence.xml for CMP2 beans.  I added
some parameters to and it ignored them.  Each time it deploys, it uses the
default broker.  Is there reason why this file might be ignored for CMP2
beans?

Thanks


Jacek Laskowski wrote:
> 
> On Fri, Feb 22, 2008 at 5:00 PM, ApolloX <sc...@selikoff.net> wrote:
> 
> Look at OpenEJB CMP2 support as a wrapper to JPA infrastructure which
> is currently based on OpenJPA. OpenEJB know nothing about
> persistence.xml and other jpa configuration files. So, effectively if
> you want to see what's going on behind the scene just trace openjpa
> with appropriate setting in persistence.xml. That should work this way
> - if it doesn't it could be a bug.
> 
> Jacek

-- 
View this message in context: http://www.nabble.com/EJB-Entity-Cache-in-Geronimo-2.1-tp15614510s134p15704824.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.


Re: EJB Entity Cache in Geronimo 2.1

Posted by Jacek Laskowski <ja...@laskowski.net.pl>.
On Fri, Feb 22, 2008 at 5:00 PM, ApolloX <sc...@selikoff.net> wrote:

>  I discovered I could set the default jpa properties previously mentioned for
>  the server by adding them to the jpa persistence section in the server's
>  config xml file.  I think where I was most confused is that it wasn't clear
>  to me that with CMP2 in G2.1, the ultimate controller of persistence was
>  jpa.

Ah, you're right. That's the place for global configuration. Thanks
for noticing it.

>  Where does openejb fit into the architecture?  I see numerous calls all by
>  openejb in the log files.  When I see a call to a finder method by openejb
>  does that means its going to the database, or it could be using data from
>  the cache?

Look at OpenEJB CMP2 support as a wrapper to JPA infrastructure which
is currently based on OpenJPA. OpenEJB know nothing about
persistence.xml and other jpa configuration files. So, effectively if
you want to see what's going on behind the scene just trace openjpa
with appropriate setting in persistence.xml. That should work this way
- if it doesn't it could be a bug.

You might benefit from using <property name="openjpa.Log"
value="DefaultLevel=WARN,SQL=TRACE"/> in persistence.xml. See other
settings of openjpa at
http://openjpa.apache.org/docs/latest/manual/ref_guide_conf_openjpa.html.

Jacek

-- 
Jacek Laskowski
http://www.JacekLaskowski.pl

Re: EJB Entity Cache in Geronimo 2.1

Posted by ApolloX <sc...@selikoff.net>.
I discovered I could set the default jpa properties previously mentioned for
the server by adding them to the jpa persistence section in the server's
config xml file.  I think where I was most confused is that it wasn't clear
to me that with CMP2 in G2.1, the ultimate controller of persistence was
jpa.

Where does openejb fit into the architecture?  I see numerous calls all by
openejb in the log files.  When I see a call to a finder method by openejb
does that means its going to the database, or it could be using data from
the cache?

Its possible my performance issues are un-related to caching, but either way
the application which was running in G1 is now thrashing on most calls, with
wait times in the minutes.


Jacek Laskowski wrote:
> 
> Yes, persistence.xml for CMP2 ;-) Although CMP2 beans don't need
> persistence.xml you should already know that Geronimo uses JPA layer
> for JPA itself as well as for CMP2. With that said, you may have
> expected to have a persistence.xml file for CMP2 created by Geronimo
> on the fly. That's exactly how it's done. When you deploy CMP2 beans
> they're layered atop JPA and persistence.xml is created for them upon
> deployment. The persistence.xml name is persistence-unit name="cmp".
> I'm not sure if that's described somewhere (other than burried in
> openejb/geronimo mailing lists), but Running JBoss Seam 2.0.0.GA on
> Geronimo 2.1
> (http://cwiki.apache.org/GMOxSAMPLES/running-jboss-seam-200ga-on-geronimo-21.html)
> should give you more insights on the persistence.xml with cmp PU
> configured.
> 
> Jacek
> 

-- 
View this message in context: http://www.nabble.com/EJB-Entity-Cache-in-Geronimo-2.1-tp15614510s134p15643921.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.


Re: EJB Entity Cache in Geronimo 2.1

Posted by Jacek Laskowski <ja...@laskowski.net.pl>.
On Fri, Feb 22, 2008 at 6:36 AM, ApolloX <sc...@selikoff.net> wrote:

>  Does G2.1 not support caching of CMP 2.1 beans, or is this a configuration
>  issue?

Hi,

All we do is to wrap OpenJPA and let it work for us as far as JPA/CMP2
are concerned. It means that (caution: untested) you should look at
what openjpa provides and set up Geronimo pools with OpenJPA pool
settings accordingly. Take a look at 1.1. Data Cache Configuration
(http://openjpa.apache.org/docs/latest/manual/ref_guide_caching.html#ref_guide_cache_conf).

Jacek

-- 
Jacek Laskowski
http://www.JacekLaskowski.pl

Re: EJB Entity Cache in Geronimo 2.1

Posted by ApolloX <sc...@selikoff.net>.
I've noticed memory (which is available to the JVM) isn't being used leading
me to believe it's not caching any entity beans.  Every call to a finder
method hits the database.

Does G2.1 not support caching of CMP 2.1 beans, or is this a configuration
issue?

-Scott



djencks wrote:
> 
> I'm not sure what that means..... however the cmp 2.1 support in g 2.1 is
> a wrapper around jpa with IIUC the main purpose to provide correct
> functionality while you migrate your apps to JPA.  I don't think
> performance of cmp entity beans has been addressed at all.  Again IIUC the
> performance is
> 
> openjpa (jpa in g 2.x) >> cmp 2 in g 1.x (based on tranql) >> cmp 2 in g
> 2.x (wrapper around jpa)
> 
> Hopefully if I'm less than accurate someone will correct me.
> 
> thanks
> david jencks

-- 
View this message in context: http://www.nabble.com/EJB-Entity-Cache-in-Geronimo-2.1-tp15614510s134p15633908.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.