[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2431) QueryPlanCache grows without bound. Eventually gets OutOfMemoryException

Eric Goff (JIRA) noreply at atlassian.com
Thu Feb 22 11:33:31 EST 2007


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2431?page=comments#action_26219 ] 

Eric Goff commented on HHH-2431:
--------------------------------

I looked at the implementation of SimpleMRUCache, and although it fulfills most requirements,
it is somewhat lacking.

For instance

case #1: if I issue 128 "get's" for the same key, I will blow out the strong references
for other keys that are in heavy use.

case #2: If I issue 128 "put's" for unique key's, I will blow out strong references for other keys
that are in heavy use (replacing them with queries that are used once and only once).

Perhaps a better scheme is to use a low-memory footprint accounting structure that
accounts for the # get's for a particular key.   This map could have a much larger maximum
size than 128 (perhaps 2048).

Then, when it needs to decide which element to eject from the list of strongRef's it would be the element
that has been accessed the fewest # times.

(strongRef's would now contain only unique entries)

I would be happy to write such a beast (along with junit tests)

Thanx,
Eric

> QueryPlanCache grows without bound.   Eventually gets OutOfMemoryException
> --------------------------------------------------------------------------
>
>          Key: HHH-2431
>          URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2431
>      Project: Hibernate3
>         Type: Bug

>   Components: core
>     Versions: 3.2.2
>  Environment: all versions, all platforms
>     Reporter: Eric Goff

>
>
> Every time you execute a query, and that query does not match any existing queries
> in the QueryPlanCache, that query is *always* added to the Query Plan Cache, along with
> a lot of various antlr stuff.
> There seems to be no way to control it.
> Minimally, there should be some sort of heap of query plans where the
> least used query plan is ejected when the cache reaches it max size.
> The cache size should, of course, be user configurable.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira




More information about the hibernate-issues mailing list