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

Shawn Heisey commented on SOLR-13003:
-------------------------------------

ConcurrentLRUCache looks (on first blush) to be coded right, but further 
checking might reveal a problem that wasn't immediately apparent.

The rest of this comment is a side note.  It's not really connected to the 
problem in this issue, but I came across it while looking into the code, so I 
wanted to note it.

This bit of code in FastLRUCache looks problematic to me:

{code:java}
    if (maxRamBytes != Long.MAX_VALUE)  {
      int ramLowerWatermark = (int) (maxRamBytes * 0.8);
      description = generateDescription(maxRamBytes, ramLowerWatermark, 
newThread);
      cache = new ConcurrentLRUCache<K, V>(ramLowerWatermark, maxRamBytes, 
newThread, null);
    } else  {
      description = generateDescription(limit, initialSize, minLimit, 
acceptableLimit, newThread);
      cache = new ConcurrentLRUCache<>(limit, minLimit, acceptableLimit, 
initialSize, newThread, false, null);
    }
{code}

The reason I think it's problematic:  The 80 percent calculation is converted 
to an int ... which means that the maximum that the low watermark can be is 2GB 
... that's incorrect if you have requested a large enough max size.

I did some test code with that calculation.  With an input of 8589934592, which 
is 8GB, the value for the 80 percent calculation converted to an int is 
2147483647.  Far less than 80 percent.  I think that ramLowerWatermark should 
be a long, and the cast to int shouldn't be there.


> Query Result Cache does not honour maxRamBytes parameter
> --------------------------------------------------------
>
>                 Key: SOLR-13003
>                 URL: https://issues.apache.org/jira/browse/SOLR-13003
>             Project: Solr
>          Issue Type: Bug
>      Security Level: Public(Default Security Level. Issues are Public) 
>    Affects Versions: 7.3.1
>            Reporter: Cetra Free
>            Priority: Major
>         Attachments: lrucachemaxmb.png
>
>
> When using the maxRamBytes parameter with the queryResultCache directive, we 
> have seen the retained size of the cache orders of magnitude larger than what 
> is configured.
> Please see attached VisualVM output which shows the retained size is about 
> 1.5gb, but the maxRamBytes is set to 64mb.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to