[ 
https://issues.apache.org/jira/browse/HBASE-2663?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12893152#action_12893152
 ] 

Jonathan Gray commented on HBASE-2663:
--------------------------------------

i see the original copy you are talking about.  can definitely clean that up 
but i still think the other thoughts floating around are valid on a more broad 
scope.

one thing to note about the copy in queue.get()  is that we don't usually 
iterate just a small percentage of what is in the queue.  The queue won't 
contain all the blocks, just the minimum number of least-recently-used blocks 
that would need to be evicted given a specified max to free.  We pass in the 
maximum amount of bytes that would possibly have to be freed from each 
priority.  So we won't always iterate all of them, but not too bad.  still 
definitely should fix it.

> LRU cache makes needless datastructure copies during eviction
> -------------------------------------------------------------
>
>                 Key: HBASE-2663
>                 URL: https://issues.apache.org/jira/browse/HBASE-2663
>             Project: HBase
>          Issue Type: Improvement
>          Components: regionserver
>            Reporter: Todd Lipcon
>
> Was browsing the LRU eviction code and came upon some very inefficient code. 
> When we do eviction, BlockBucket.free() calls queue.get() which first inserts 
> everything from the PriorityQueue<Block> into a LinkedList, then copies that 
> entire linked list into an array. We then iterate over usually just a small 
> percentage of the array to free some blocks until we have freed the requested 
> amount.
> We ought to be able to just pull items out of the PriorityQueue directly and 
> avoid all the churn.

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

Reply via email to