|
Re: readonly query and mix isolated and shared cache types [message #1355157 is a reply to message #1354802] |
Wed, 14 May 2014 15:45 |
Peter Nehrer Messages: 241 Registered: July 2009 |
Senior Member |
|
|
FWIW... with 2.5.1 I'm finding that having so much as a single isolated
entity in the model basically negates shared cache as each session
that's set up is isolated and nothing is ever found in the "parent"
session (shared cache) as implied by documentation.
For the time being I'm leaving shared cache enabled on every entity but
annotate the few that should not be cached with alwaysRefresh=true,
disableHits=true. This seems to be doing the right thing.
On 5/14/14, 9:19 AM, Serge Poberezhnik wrote:
> Hello!
>
> I have two entities. One is highly volatile entity Event, references
> rarely changed entity EventType. So, for Event i use isolated cache
> type, and for EventType - shared cache.
> Then i need to select large list of Events for read only purpose.
> Therefore READONLY query hint is used:
> query.setHint(QueryHints.READ_ONLY, HintValues.TRUE); Then, when JPQL
> query: select e from Event e
> executes repeatedly, i see in eclipselink log that reference to
> EventType resolves for selected Events each time with physical query
> from EventType table:
> select * from EventType where typeCode = ?
> Not just in first JPQL query executing, but each time. So shared cache
> for EventType entity not used for references resolving. This significant
> reduces overall JPQL query performance execution.
> Such behavior begins after start using Glassfish 4.0. with corresponded
> eclipselink version 2.5.1. With version 2.5.0 and 2.4.0 this situation
> is reproduced too. In Glassfish 3.2 with eclipselink version 2.3.2
> everything was fine - shared cache was used for resolving references
> from isolated caching enttities in readonly queries.
>
> Is somebody stucks with such problem? What should i do to right
> configure entities and query?
|
|
|
Re: readonly query and mix isolated and shared cache types [message #1357079 is a reply to message #1355157] |
Thu, 15 May 2014 10:55 |
Serge Poberezhnik Messages: 2 Registered: May 2014 |
Junior Member |
|
|
Thank for your reply, Peter
you wroteFor the time being I'm leaving shared cache enabled on every entity but
annotate the few that should not be cached with alwaysRefresh=true,
disableHits=true. This seems to be doing the right thing.
I tried to do this. Setting up alwaysRefresh=true, disableHits=true in entity cache options leads to appearing lots of additional physical queries to refresh each of selected rows, such as select * from Event where eventId = ? That essentially reduce query performance and not minimize memory usage for cache. I need to select huge amount of frequently changed data. It would be right to not cache this data at all. Otherwise, when shared cache for this entity is enabled, memory is ended soon and throwing java heap space error in a log.
When i set up shared cache size to 0, this equivalent to switching off the shared cache usage for referenced entities too. It began to selecting directly from database, ommiting cache repeatedly. Query becomes too slow.
Setting cache size to small value, say 10 doesn't effect and "java heap space" error is coming soon
|
|
|
Powered by
FUDForum. Page generated in 0.03716 seconds