[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5927?page=c...
]
Lari Hotari commented on HHH-5927:
----------------------------------
org.hibernate.util.SoftLimitMRUCache.get(Object) (called by
org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(String, boolean, Map)) is
showing up as the top blocker in a performance test of a Grails application. I hope this
issue is fixed ASAP. Grails 2.0 will use 3.6.x so I hope the fix gets in to 3.6.x .
Already in 3.6.8?
btw. The synchronization to SoftLimitMRUCache.get was probably added in HHH-1486 .
Grails is using [a ConcurrentLinkedHashMap for
Java|http://code.google.com/p/concurrentlinkedhashmap/] as a LRU cache internally.
Performance risk: Suboptimal synchronization in
org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan
---------------------------------------------------------------------------------------------------------
Key: HHH-5927
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5927
Project: Hibernate Core
Issue Type: Improvement
Components: core
Reporter: Strong Liu
Attachments: hotspot.png
with Order Demo (real-life simulation attempt test app) I have noticed that there is
thread contention on createNamesQuery() which sounds suspicious.
After investigation it boils down to
org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan. It serves as a cache (internal,
not replacable) for queries using LRU algorithm (supplied from Apache utils).
Generally speaking, blocking threads in any sort of caches indicates a problem. From
about 2000 calls, 700 got blocked (which is also not nice for context switching).
I guess, one of the problems is that there is exclusive synchronization in get method:
public synchronized Object get(Object key) {...}
which could be replaced by a more granular read-write lock.
org/hibernate/engine/query/QueryPlanCache.java
org/hibernate/util/SoftLimitMRUCache.java
--
This message is automatically generated by JIRA.
For more information on JIRA, see:
http://www.atlassian.com/software/jira