The Source for Java Technology Collaboration
Webmaster Alert: Posting to Jive Forums is currently not working. Estimated time for fix is unknown.

Home » java.net Forums » GlassFish » GlassFish

Thread: GlassFish v2 cluster & Toplink Essentials cache: how it works together

Welcome, Guest Help
Login Login
Guest Settings Guest Settings
Reply to this Thread Reply to this Thread Search Forum Search Forum Back to Thread List Back to Thread List

Permlink Replies: 3 - Last Post: Dec 4, 2006 11:27 AM by: vicnov
vicnov

Posts: 16
GlassFish v2 cluster & Toplink Essentials cache: how it works together
Posted: Nov 15, 2006 1:21 PM
  Click to reply to this thread Reply

I am interested in how it works together in GlassFish v2 - clustering functionality and Toplink Essentials caching?

I read this:
https://glassfish.dev.java.net/servlets/BrowseList?list=persistence&by=thread&from=514263
http://www.oracle.com/technology/products/ias/toplink/jpa/resources/toplink-jpa-extensions.html#TopLinkCaching

and this issue:
https://glassfish.dev.java.net/issues/show_bug.cgi?id=1117

But none of the discussions answer my questions:

1) Does the persistence engine in Glassfish v2 _cluster_ use entity caching?
2) Is this Toplink Essentials' "out-of-the-box" cache or something else?
3) How is this cache configured?
4) Is this cache cluster-aware (data in the cache is replicated automatically to all nodes in the cluster)

As I understand, the internal Toplink Essentials' cache does not work well in cluster - data is not replicated to all nodes and we see incorrect behaviour sometimes (out-of-date data on some nodes). The only way to make it working in cluster is to turn OFF the Toplink Essentials' cache...

pkrogh

Posts: 5
Re: GlassFish v2 cluster & Toplink Essentials cache: how it works together
Posted: Nov 16, 2006 12:01 PM   in response to: vicnov
  Click to reply to this thread Reply

Hi,

The object level cache in TopLink serves two main purposes. The first being a performance optimization, minimizing the number of round trips to the database. The second purpose is maintaining object identity within a node.

TopLink Essentials does not automatically propagate changes to different nodes of the cluster, but turning off the cache is generally not the recommended solution. Proper configuration of the cache can help ensure that you are getting correct data, and still getting the performance benefit of caching.

First, you need to pick the right cache types for your application based on the Volatility of your objects. For example, objects that are Read Mostly with lots of sharing might be best configured to use a SoftCacheWeak, whereas objects that are Write Mostly might be best configured with a Weak cache.

Also, configuring locking and refreshing is key in ensuring that stale data is not used.

For more information on locking and caching, please see: http://www.oracle.com/technology/tech/java/newsletter/articles/toplink/toplink_caching_locking.html.

vicnov

Posts: 16
Re: GlassFish v2 cluster & Toplink Essentials cache: how it works together
Posted: Nov 21, 2006 8:56 AM   in response to: pkrogh
  Click to reply to this thread Reply

pkrogh
I read this article before (there are not so many articles about Toplink in fact ;) ) - I understand purpose of using Toplink cache. Yes, I can configure cache for each concrete task, for each entity type (in many situations this means that I should turn off the cache...).

Let me describe my question in more details.

This is not a practical task/problem for me now, I am just interested in how it works. I would like to understand.
I wonder how GlassFish v2 works with Toplink Essentials in clustered environment -
does GlassFish use something special (specific entity cache implementation - maybe plugged into Toplink Essentials) or some specific configuration, etc.

If I understand you correctly, GlassFish uses Toplink Essentials "as is" without any specific configuration/wrappers/workarounds, etc ?

There are several "cluster-aware" caches like EHCache or SwarmCache - in fact it would be great that developers could plug 3rd party cache implementations into Toplink Essentials... (see this issue - https://glassfish.dev.java.net/issues/show_bug.cgi?id=1117).
"Choice is good!" :) (C) http://blogs.sun.com/roumen/entry/choice_is_good
Are there any plans or thoughts about this issue in the Community?
Or, maybe, there plans to use another mechanisms of entity caching? I think such things as cluster-aware caching are very important for "production class" enterprise server.
Or I understand something incorrectly?

vicnov

Posts: 16
Re: GlassFish v2 cluster & Toplink Essentials cache: how it works together
Posted: Dec 4, 2006 11:27 AM   in response to: vicnov
  Click to reply to this thread Reply

Please, could somebody clarify the things?




 XML java.net RSS