Uploaded image for project: 'OpenJPA'
  1. OpenJPA
  2. OPENJPA-738

QueryCache Improvement

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.2.0, 1.2.1, 1.3.0
    • 1.3.0
    • datacache
    • None

    Description

      Hi All,

      I have changed the jpa code to eliminate the scan of the jpa query cache to invalidate cached queries that is triggered by entity bean values changes. The problem with the current code is that whenever an entity bean value changes, the query cache needs to be scanned and all the queries that are related to the changed entity bean should be invalidated. This is resulting in poor performance when the querycache has too many queries in it.

      The new approach is to track the timestamp of the query and the timestamp of last update for each entity class and compare the timestamps when retrieving the query for reuse. If the timestamp of the query result is older than the last update time of any entity in the access path of the query, the query result would not be reused and the query result would be evicted from the query cache.

      I introduced a configurable attribute in the persistence.xml in QueryCache property "evictOnTimestamp=true". Therefore the QueryCache property in persistence.xml file looks as follows:

      <property name="openjpa.QueryCache" value = "CacheSize=1000, evictOnTimestamp=true" />

      If the "evictOnTimestamp" value is set to true in the xml file the new code is invoked otherwise the old code. The default behaviour would be the old code. That is the value for "evictOnTimestamp" is false by default so that if this property is not set persistence.xml, old code gets invoked.

      In the process of changing the code to evict the queries using the timestamp, I had to introduce 4 methods in QueryCache interface. We want this change to be applied to JPA trunk and 1.2.x branch. Anyone who is extending the QueryCache that implements this interface would have to implement these 4 methods. Please respond as soon as possible if this interface change is an issue.

      Attachments

        1. OPENJPA-738.10.patch
          24 kB
          Sandhya
        2. OPENJPA-738.11.patch
          24 kB
          Sandhya
        3. OPENJPA-738.2.patch
          25 kB
          Sandhya
        4. OPENJPA-738.3.patch
          19 kB
          Sandhya
        5. OPENJPA-738.6.patch
          33 kB
          Catalina Wei
        6. OPENJPA-738.7.patch
          2 kB
          Sandhya
        7. OPENJPA-738.8.patch
          21 kB
          Sandhya
        8. OPENJPA-738.patch
          21 kB
          Sandhya

        Issue Links

          Activity

            People

              mikedd Michael Dick
              turagasandy Sandhya
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: