Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Performance degarde on using caching option

Are you indicating that there is problem, or just trying to explain your results?

More information is required. Is there a reason you are using the checkCacheOnly option instead of the default? What are you using for the original query as a comparison? If you mean the original query was a straight SQL select that goes to the database compared to this, the SQL query will go to the database and the rows returned used to get the objects from the cache. This current query will not hit the database at all, due to the checkCacheOnly option being used. Instead, it will go through every single Sample object it has in the cache and check to see if the NonPromaryKeyProperty1.equals("kk") and NonPromaryKeyProperty2.equals("jj") until it finds what it is looking for. The speed this is done is affected by the processor, application load and the number of objects in the cache, even the how the JVM implements string comparisons. At some level of JVM load, at some number of objects in the cache etc, it will be expected that the in memory query will be slower than a query that uses the database. Using a more powerful processor on a JVM with no load and infinite resources in a cache of very limited size (say 1 object), I might expect the in memory query to be faster - assuming the java string comparisons can be done faster than the time it requires to send a JDBC statement to the database and get a result back. There are better options to use for performance depending on what you are attemping.

Best Regards,
Chris





On 23/07/2010 10:32 AM, Kiran Kumar Gubbi wrote:
After changing queries from nativequery to sessionquery the performance of
the application drastically degraded. Used the following setting for entity
and data access object for caching.

Entity class
@Cache(
type = CacheType.SOFT, shared = true,
		size = 10000,
		coordinationType = CacheCoordinationType.SEND_OBJECT_CHANGES
)


DAO method ( before calling this methops List of sample objects are
available in cache)
public Sample getSample() {
  Sample sample = new Sample();
  sample.setNonPromaryKeyProperty1("kk");
  sample.setNonPromaryKeyProperty2("jj");

  ReadObjectQuery query = new ReadObjectQuery( Sample.class );
  query.setExampleObject( sample);
  query.checkCacheOnly();

  return ( Sample ) session().executeQuery( query );
}

This change has degraded performance by 3 times.  Any suggestion please.


Kind regards,
kiran



Back to the top