[ 
https://issues.apache.org/jira/browse/JENA-901?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14371572#comment-14371572
 ] 

ASF GitHub Bot commented on JENA-901:
-------------------------------------

GitHub user stain opened a pull request:

    https://github.com/apache/jena/pull/44

    JENA-901 Upper bound on LPDRuleEngine cache

    Fixes JENA-901.
    
    A better solution might be to use guava caches - but I didn't want to add 
another dependency, so this fix can go into a patch release.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/stain/jena JENA-901-LPDRuleEngine-bound-cache

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/jena/pull/44.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #44
    
----
commit 50511efc0e3cdeaee95ee7254483b1ea9c1f9fea
Author: Stian Soiland-Reyes <[email protected]>
Date:   2015-03-19T02:52:08Z

    JENA-901
    
    A simple BoundedMap - based on LinkedHashMap

commit 06abde7d170bdc76ac3f9a7ef4159bb625028cfe
Author: Stian Soiland-Reyes <[email protected]>
Date:   2015-03-19T02:52:30Z

    JENA-901 Use BoundedMap for tabledGoals cache
    
    configurable with system property
    jena.rulesys.lp.max_cached_tabled_goals

commit 0b2e72b7d604940c5b084f026c437484856e929a
Author: Stian Soiland-Reyes <[email protected]>
Date:   2015-03-19T02:55:06Z

    JENA-901 Test saturation of tabledGoals

commit 83d7e8cfdd50f3de849731bf56cadf1d1daec15c
Author: Stian Soiland-Reyes <[email protected]>
Date:   2015-03-19T03:53:02Z

    measure size of engine

commit 938db892729d7f1849c0a6f71b27ebd4d1be3ff9
Author: Stian Soiland-Reyes <[email protected]>
Date:   2015-03-19T04:16:02Z

    more reset.. still uses lots of memory

commit 3d01fffa0d9ab6ee34b7f0e8ac540a53f3bf22c3
Author: Stian Soiland-Reyes <[email protected]>
Date:   2015-03-20T16:23:36Z

    JENA-901 use a LinkedList instead of ArrayList
    
    for activeInterpreters. They could be closed in arbitrary order,
    and also this avoids a large ArrayList remaining after a big burst
    of concurrent queries.
    
    Simplify test. Check activeInterpreters is empty - this didn't
    happen as I had forgotten to call it.hasNext() (which any use of
    an iterator would normally do).
    
    Test now with MAX=1024 and 128M find() calls.

----


> Make the cache of LPBRuleEngine bounded to avoid out-of-memory
> --------------------------------------------------------------
>
>                 Key: JENA-901
>                 URL: https://issues.apache.org/jira/browse/JENA-901
>             Project: Apache Jena
>          Issue Type: Improvement
>          Components: Reasoners
>    Affects Versions: Jena 2.12.1
>            Reporter: Jan De Beer
>
> The class "com.hp.hpl.jena.reasoner.rulesys.impl.LPBRuleEngine" uses an 
> in-memory cache named "tabledGoals", which has no limit as to the size/number 
> of entries stored.
> {noformat}
>     /** Table mapping tabled goals to generators for those goals.
>      *  This is here so that partial goal state can be shared across multiple 
> queries. */
>     protected HashMap<TriplePattern, Generator> tabledGoals = new HashMap<>();
> {noformat}
> We have experienced out-of-memory issues because of the cache being filled 
> with millions of entries in just a few days under normal query usage 
> conditions and a heap memory set to 3GB.
> In our setup, we have a dataset containing multiple graphs, some of them are 
> actual data graphs (backed by TDB), and then there are two which are ontology 
> models using a "TransitiveReasoner" and an "OWLMicroFBRuleReasoner", 
> respectively. A typical query may run over all the graphs in the dataset, 
> including the ontology ones (see below for a query template). Eventhough the 
> ontology graphs would not yield any additional results for data queries 
> (which is fine), the above mentioned cache would still fill up with new 
> entries.
> {noformat}
> SELECT ?p ?o
> WHERE {
>   GRAPH ?g {
>     <some resource of interest> ?p ?o .
>   }
> }
> {noformat}
> As there is no upper bound to the cache, soon or later all available heap 
> memory will be consumed by the cache, giving rise to an out-of-memory 
> criticial error.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to