You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Sandhya (JIRA)" <ji...@apache.org> on 2008/10/07 01:20:44 UTC

[jira] Created: (OPENJPA-738) QueryCache Improvement

QueryCache Improvement
----------------------

                 Key: OPENJPA-738
                 URL: https://issues.apache.org/jira/browse/OPENJPA-738
             Project: OpenJPA
          Issue Type: Improvement
          Components: datacache
    Affects Versions: 1.2.0, 1.2.1, 1.3.0
            Reporter: Sandhya


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. 
        			  


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (OPENJPA-738) QueryCache Improvement

Posted by "Sandhya (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-738?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sandhya updated OPENJPA-738:
----------------------------

    Attachment: OPENJPA-738.7.patch

One of the comments regarding the naming of the method were too implementation specific. This patch has renamed methods. 
The method "getEntityTimestampFromMap" is changed to "getEntityTimestamp()" and the method "updateEntityTimestampMap()" is changed to "updateEntityTimestamp()".

Thanks
Sandhya Turaga

> QueryCache Improvement
> ----------------------
>
>                 Key: OPENJPA-738
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-738
>             Project: OpenJPA
>          Issue Type: Improvement
>          Components: datacache
>    Affects Versions: 1.2.0, 1.2.1, 1.3.0
>            Reporter: Sandhya
>             Fix For: 1.3.0
>
>         Attachments: OPENJPA-738.2.patch, OPENJPA-738.3.patch, OPENJPA-738.6.patch, OPENJPA-738.7.patch, OPENJPA-738.patch
>
>
> 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. 
>         			  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OPENJPA-738) QueryCache Improvement

Posted by "Michael Dick (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-738?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12638103#action_12638103 ] 

Michael Dick commented on OPENJPA-738:
--------------------------------------

The biggest issue I have with the patch is the interface changes. Adding methods to an interface in trunk is acceptable, but introducing them into a service release (1.2.1 or 1.2.2) can cause too much churn for downstream consumers. 

Updating the abstract classes we include can lessen the impact to third party cache plugins. Extending the abstract classes is recommended but is not required - if we put the change as is into a service release we could break other L2 query caches. 

> QueryCache Improvement
> ----------------------
>
>                 Key: OPENJPA-738
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-738
>             Project: OpenJPA
>          Issue Type: Improvement
>          Components: datacache
>    Affects Versions: 1.2.0, 1.2.1, 1.3.0
>            Reporter: Sandhya
>         Attachments: OPENJPA-738.2.patch, OPENJPA-738.patch
>
>
> 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. 
>         			  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (OPENJPA-738) QueryCache Improvement

Posted by "Sandhya (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-738?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sandhya updated OPENJPA-738:
----------------------------

    Attachment: OPENJPA-738.3.patch

Hi All,

    Please find the updated patch file for the querycache improvement. This patch does not have any methods in the QueryCache interface.  Introduced 3 new methods in the AbstractQueryCache instead. If this looks fine this would be final copy which will be checked into trunk. Please post you comments if any

Thanks
Sandhya Turaga


> QueryCache Improvement
> ----------------------
>
>                 Key: OPENJPA-738
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-738
>             Project: OpenJPA
>          Issue Type: Improvement
>          Components: datacache
>    Affects Versions: 1.2.0, 1.2.1, 1.3.0
>            Reporter: Sandhya
>         Attachments: OPENJPA-738.2.patch, OPENJPA-738.3.patch, OPENJPA-738.patch
>
>
> 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. 
>         			  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (OPENJPA-738) QueryCache Improvement

Posted by "Sandhya (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-738?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sandhya updated OPENJPA-738:
----------------------------

    Attachment: OPENJPA-738.patch

 I am  attaching the patch file that has all my changes to the code. 
Your comments and suggestions will be very helpful. 
        			  
Thanks
Sandhya Turaga


> QueryCache Improvement
> ----------------------
>
>                 Key: OPENJPA-738
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-738
>             Project: OpenJPA
>          Issue Type: Improvement
>          Components: datacache
>    Affects Versions: 1.2.0, 1.2.1, 1.3.0
>            Reporter: Sandhya
>         Attachments: OPENJPA-738.patch
>
>
> 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. 
>         			  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (OPENJPA-738) QueryCache Improvement

Posted by "Michael Dick (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-738?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael Dick resolved OPENJPA-738.
----------------------------------

    Resolution: Fixed

> QueryCache Improvement
> ----------------------
>
>                 Key: OPENJPA-738
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-738
>             Project: OpenJPA
>          Issue Type: Improvement
>          Components: datacache
>    Affects Versions: 1.2.0, 1.2.1, 1.3.0
>            Reporter: Sandhya
>            Assignee: Michael Dick
>             Fix For: 1.3.0
>
>         Attachments: OPENJPA-738.10.patch, OPENJPA-738.11.patch, OPENJPA-738.2.patch, OPENJPA-738.3.patch, OPENJPA-738.6.patch, OPENJPA-738.7.patch, OPENJPA-738.8.patch, OPENJPA-738.patch
>
>
> 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. 
>         			  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OPENJPA-738) QueryCache Improvement

Posted by "Catalina Wei (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-738?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12641437#action_12641437 ] 

Catalina Wei commented on OPENJPA-738:
--------------------------------------

OPENJPA-738.6.patch does not have any interface changes, and the configurable property for query eviction policy is a String value so it is more extendable.

> QueryCache Improvement
> ----------------------
>
>                 Key: OPENJPA-738
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-738
>             Project: OpenJPA
>          Issue Type: Improvement
>          Components: datacache
>    Affects Versions: 1.2.0, 1.2.1, 1.3.0
>            Reporter: Sandhya
>             Fix For: 1.3.0
>
>         Attachments: OPENJPA-738.2.patch, OPENJPA-738.3.patch, OPENJPA-738.6.patch, OPENJPA-738.patch
>
>
> 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. 
>         			  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (OPENJPA-738) QueryCache Improvement

Posted by "Sandhya (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-738?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sandhya updated OPENJPA-738:
----------------------------

    Attachment: OPENJPA-738.8.patch

This patch has some changes to the coding style and some clean up to the code by removing some string comparisons.

Thanks
Sandhya Turaga

> QueryCache Improvement
> ----------------------
>
>                 Key: OPENJPA-738
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-738
>             Project: OpenJPA
>          Issue Type: Improvement
>          Components: datacache
>    Affects Versions: 1.2.0, 1.2.1, 1.3.0
>            Reporter: Sandhya
>             Fix For: 1.3.0
>
>         Attachments: OPENJPA-738.2.patch, OPENJPA-738.3.patch, OPENJPA-738.6.patch, OPENJPA-738.7.patch, OPENJPA-738.8.patch, OPENJPA-738.patch
>
>
> 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. 
>         			  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (OPENJPA-738) QueryCache Improvement

Posted by "Catalina Wei (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-738?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Catalina Wei updated OPENJPA-738:
---------------------------------

    Attachment: OPENJPA-738.6.patch

The attached patch is from Sandhya Turaga which was commited under r706481.


> QueryCache Improvement
> ----------------------
>
>                 Key: OPENJPA-738
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-738
>             Project: OpenJPA
>          Issue Type: Improvement
>          Components: datacache
>    Affects Versions: 1.2.0, 1.2.1, 1.3.0
>            Reporter: Sandhya
>             Fix For: 1.3.0
>
>         Attachments: OPENJPA-738.2.patch, OPENJPA-738.3.patch, OPENJPA-738.6.patch, OPENJPA-738.patch
>
>
> 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. 
>         			  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OPENJPA-738) QueryCache Improvement

Posted by "Kevin Sutter (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-738?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12641383#action_12641383 ] 

Kevin Sutter commented on OPENJPA-738:
--------------------------------------

I had some earlier concerns with the patch that I had communicated to Sandhya privately.  So, I'm not sure if this patch was ready to be committed.  I will touch base with Sandhya later today and find out the current status of this Issue.  Thanks.

> QueryCache Improvement
> ----------------------
>
>                 Key: OPENJPA-738
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-738
>             Project: OpenJPA
>          Issue Type: Improvement
>          Components: datacache
>    Affects Versions: 1.2.0, 1.2.1, 1.3.0
>            Reporter: Sandhya
>             Fix For: 1.3.0
>
>         Attachments: OPENJPA-738.2.patch, OPENJPA-738.3.patch, OPENJPA-738.patch
>
>
> 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. 
>         			  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (OPENJPA-738) QueryCache Improvement

Posted by "Sandhya (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-738?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sandhya updated OPENJPA-738:
----------------------------

    Attachment: OPENJPA-738.2.patch

Hi All,

           Please find the updated patch file. In this one I have made some changes to the coding style that Mike has suggested and also added some code so that the entityTimestamp map can handle the synchronization issues.

Thanks
Sandhya Turaga

> QueryCache Improvement
> ----------------------
>
>                 Key: OPENJPA-738
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-738
>             Project: OpenJPA
>          Issue Type: Improvement
>          Components: datacache
>    Affects Versions: 1.2.0, 1.2.1, 1.3.0
>            Reporter: Sandhya
>         Attachments: OPENJPA-738.2.patch, OPENJPA-738.patch
>
>
> 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. 
>         			  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (OPENJPA-738) QueryCache Improvement

Posted by "Sandhya (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-738?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sandhya updated OPENJPA-738:
----------------------------

    Attachment: OPENJPA-738.10.patch

I have added documentation in this patch.

> QueryCache Improvement
> ----------------------
>
>                 Key: OPENJPA-738
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-738
>             Project: OpenJPA
>          Issue Type: Improvement
>          Components: datacache
>    Affects Versions: 1.2.0, 1.2.1, 1.3.0
>            Reporter: Sandhya
>             Fix For: 1.3.0
>
>         Attachments: OPENJPA-738.10.patch, OPENJPA-738.2.patch, OPENJPA-738.3.patch, OPENJPA-738.6.patch, OPENJPA-738.7.patch, OPENJPA-738.8.patch, OPENJPA-738.patch
>
>
> 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. 
>         			  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OPENJPA-738) QueryCache Improvement

Posted by "Fay Wang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-738?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12643611#action_12643611 ] 

Fay Wang commented on OPENJPA-738:
----------------------------------

OPENJPA-738.11.patch is committed in trunk r708980. 

> QueryCache Improvement
> ----------------------
>
>                 Key: OPENJPA-738
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-738
>             Project: OpenJPA
>          Issue Type: Improvement
>          Components: datacache
>    Affects Versions: 1.2.0, 1.2.1, 1.3.0
>            Reporter: Sandhya
>             Fix For: 1.3.0
>
>         Attachments: OPENJPA-738.10.patch, OPENJPA-738.11.patch, OPENJPA-738.2.patch, OPENJPA-738.3.patch, OPENJPA-738.6.patch, OPENJPA-738.7.patch, OPENJPA-738.8.patch, OPENJPA-738.patch
>
>
> 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. 
>         			  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (OPENJPA-738) QueryCache Improvement

Posted by "Catalina Wei (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-738?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Catalina Wei updated OPENJPA-738:
---------------------------------

    Fix Version/s: 1.3.0

Patch is committed in trunk r706481.
This issure remain open until documentation is updated for the new configurable property of Query TimestampEviction policy.

> QueryCache Improvement
> ----------------------
>
>                 Key: OPENJPA-738
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-738
>             Project: OpenJPA
>          Issue Type: Improvement
>          Components: datacache
>    Affects Versions: 1.2.0, 1.2.1, 1.3.0
>            Reporter: Sandhya
>             Fix For: 1.3.0
>
>         Attachments: OPENJPA-738.2.patch, OPENJPA-738.3.patch, OPENJPA-738.patch
>
>
> 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. 
>         			  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (OPENJPA-738) QueryCache Improvement

Posted by "Sandhya (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-738?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sandhya updated OPENJPA-738:
----------------------------

    Attachment: OPENJPA-738.11.patch

Just posting the final patch. This is has no changes from the previous patch(OPENJPA-738.10).

Thanks
Sandhya

> QueryCache Improvement
> ----------------------
>
>                 Key: OPENJPA-738
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-738
>             Project: OpenJPA
>          Issue Type: Improvement
>          Components: datacache
>    Affects Versions: 1.2.0, 1.2.1, 1.3.0
>            Reporter: Sandhya
>             Fix For: 1.3.0
>
>         Attachments: OPENJPA-738.10.patch, OPENJPA-738.11.patch, OPENJPA-738.2.patch, OPENJPA-738.3.patch, OPENJPA-738.6.patch, OPENJPA-738.7.patch, OPENJPA-738.8.patch, OPENJPA-738.patch
>
>
> 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. 
>         			  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (OPENJPA-738) QueryCache Improvement

Posted by "Michael Dick (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-738?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael Dick reassigned OPENJPA-738:
------------------------------------

    Assignee: Michael Dick

> QueryCache Improvement
> ----------------------
>
>                 Key: OPENJPA-738
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-738
>             Project: OpenJPA
>          Issue Type: Improvement
>          Components: datacache
>    Affects Versions: 1.2.0, 1.2.1, 1.3.0
>            Reporter: Sandhya
>            Assignee: Michael Dick
>             Fix For: 1.3.0
>
>         Attachments: OPENJPA-738.10.patch, OPENJPA-738.11.patch, OPENJPA-738.2.patch, OPENJPA-738.3.patch, OPENJPA-738.6.patch, OPENJPA-738.7.patch, OPENJPA-738.8.patch, OPENJPA-738.patch
>
>
> 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. 
>         			  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.