You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Theo Niemeijer <th...@juras.org> on 2003/03/31 12:30:22 UTC

JBoss EJB and OJB: how to use the caching ?

Hello all,

Does anyone have experiences to share about caching in EJB environments ?
I would like to know how multiple JBoss/OJB instances can share the same
cache or at least not have long-term cache-inconsistencies.

If the "backoffice" CMS webapp updates items I want to see them a short
time lateron correctly changed in the "frontoffice" website.
Not having a cache at all however would severely impact our performance.


Background:

I am currently investigating the possibilities of improving performance of our OJB based application. The application consists of
three webapplications on Tomcat, connected to Session EJB's on a central JBoss server that uses OJB for Object/Relational mapping.

I think that the performance of the application depends on the use of caching (the application is mostly retrieval from searching).
We use the default implementation.

We use separate Tomcat webservers: the frontoffice is a separate webapp in it's own Tomcat instance, and the backoffice CMS is is a
separate webapp in it's own Tomcat. So they each talk with JBoss via RMI over the network !

However, JBoss advices to use the integrated Tomcat with JBoss, because it avoids the RMI network transports and the serialisation
of data.

If we would go for integrated JBoss+Tomcat instances then we would have multiple OJB instances that share the same database but not
the same cache ! That would probably mean cache inconsistencies because the default implementation AFAIK has no maximum object
lifetime and no distributed synchronisations ?

Answers anyone ?

	Theo Niemeijer





RE: JBoss EJB and OJB: how to use the caching ?

Posted by Theo Niemeijer <th...@juras.org>.
Armin,
Thanks for your clear answer. I do have a related question that I was wondering about...

I understand that this cache coherence is tricky business anyway, because no matter how you would implement it, it would always
create either a lot of overhead/locking or short-term cache inconsistencies.

So there is a very related thing I would like to ask you: How should I cope with the fact that if I get a (actually the) cached copy
of an object and update its properties there is a (short) period of time where the cached object actually contains uncommitted and
perhaps even inconsistent data ?  If I understand correctly the cached objects (in its default implementation that I trust upon) are
"shared" objects, not copies that can be changed without affecting the other "users" ? Therefore all threads that received that
shared object from the cache will be affected by these changes ?

I must admit that in the 3-tier implementation we have now this is not a problem, because after the EJB RMI serialisation we do
actually recieve copies at the client side (which is another problem in itself), and when these are stored they have become actually
independent copies at the server side also, but in a single-VM solution (JBoss and Tomcat in the same VM) this serialisation will
not take place and the above problem might present itself.

If I would use per-PersistenceBroker caches, then these would not help very much for overall retrieval performance I guess, because
they would not be shared, and be cleared after I give the broker back to the pool (which happens very frequently) ?

(I guess I am quite clueless on how the cache should actually work. My situation is 99% retrieval and 1% updates, inserts and
deletes. I like the global cache because it helps retrieval performance, but I sometimes encountered cache inconsistencies related
to referenced objects and n:m relationships that I solve by "manually" clearing the referenced or related objects, which I guess OJB
could very well have done itself using the same information)


Regards,
	Theo Niemeijer



> -----Oorspronkelijk bericht-----
> Van: Armin Waibel [mailto:armin.waibel@code-au-lait.de]
> Verzonden: dinsdag 1 april 2003 3:21
> Aan: OJB Users List
> Onderwerp: Re: JBoss EJB and OJB: how to use the caching ?
>
>
> Hi Theo,
>
> > Does anyone have experiences to share about caching in EJB
> environments ?
> > I would like to know how multiple JBoss/OJB instances can share the
> same
>
> Currently we don't have a cache implementation which fulfill these
> requirements.
>
> > cache or at least not have long-term cache-inconsistencies.
>
> use 'empty' the cache, or the 'perBroker' cache implementation
> to avoid caching problems.
>
> >
> > If the "backoffice" CMS webapp updates items I want to see them a
> short
> > time lateron correctly changed in the "frontoffice" website.
> > Not having a cache at all however would severely impact our
> performance.
> >
>
> We want to refactoring the cache package in near future, to make
> a more sophisticated cache available.
>
> regards,
> Armin
>
>
> >
> > Background:
> >
> > I am currently investigating the possibilities of improving
> performance of our OJB based application. The application consists of
> > three webapplications on Tomcat, connected to Session EJB's on a
> central JBoss server that uses OJB for Object/Relational mapping.
> >
> > I think that the performance of the application depends on the use of
> caching (the application is mostly retrieval from searching).
> > We use the default implementation.
> >
> > We use separate Tomcat webservers: the frontoffice is a separate
> webapp in it's own Tomcat instance, and the backoffice CMS is is a
> > separate webapp in it's own Tomcat. So they each talk with JBoss via
> RMI over the network !
> >
> > However, JBoss advices to use the integrated Tomcat with JBoss,
> because it avoids the RMI network transports and the serialisation
> > of data.
> >
> > If we would go for integrated JBoss+Tomcat instances then we would
> have multiple OJB instances that share the same database but not
> > the same cache ! That would probably mean cache inconsistencies
> because the default implementation AFAIK has no maximum object
> > lifetime and no distributed synchronisations ?
> >
> > Answers anyone ?
> >
> > Theo Niemeijer
> >
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> > For additional commands, e-mail: ojb-user-help@db.apache.org
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>


Re: JBoss EJB and OJB: how to use the caching ?

Posted by Armin Waibel <ar...@code-au-lait.de>.
Hi Theo,

> Does anyone have experiences to share about caching in EJB
environments ?
> I would like to know how multiple JBoss/OJB instances can share the
same

Currently we don't have a cache implementation which fulfill these
requirements.

> cache or at least not have long-term cache-inconsistencies.

use 'empty' the cache, or the 'perBroker' cache implementation
to avoid caching problems.

>
> If the "backoffice" CMS webapp updates items I want to see them a
short
> time lateron correctly changed in the "frontoffice" website.
> Not having a cache at all however would severely impact our
performance.
>

We want to refactoring the cache package in near future, to make
a more sophisticated cache available.

regards,
Armin


>
> Background:
>
> I am currently investigating the possibilities of improving
performance of our OJB based application. The application consists of
> three webapplications on Tomcat, connected to Session EJB's on a
central JBoss server that uses OJB for Object/Relational mapping.
>
> I think that the performance of the application depends on the use of
caching (the application is mostly retrieval from searching).
> We use the default implementation.
>
> We use separate Tomcat webservers: the frontoffice is a separate
webapp in it's own Tomcat instance, and the backoffice CMS is is a
> separate webapp in it's own Tomcat. So they each talk with JBoss via
RMI over the network !
>
> However, JBoss advices to use the integrated Tomcat with JBoss,
because it avoids the RMI network transports and the serialisation
> of data.
>
> If we would go for integrated JBoss+Tomcat instances then we would
have multiple OJB instances that share the same database but not
> the same cache ! That would probably mean cache inconsistencies
because the default implementation AFAIK has no maximum object
> lifetime and no distributed synchronisations ?
>
> Answers anyone ?
>
> Theo Niemeijer
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>