Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
fix possible unconstrained memory growth in modules/libjsc #891
When libjsc was converted over to use the new hierarchical directory scheme under
This PR changes the internal hash of jobid to kvs path mappings into an LRU cache. The cache, for now, has a max size of 256. If needed, this could be made configurable or adjustable later.
The simple LRU cache implementation is added to libutil in case it can be used elsewhere.
Current coverage is 72.20% (diff: 90.24%)
@@ master #891 diff @@ ========================================== Files 156 157 +1 Lines 26934 27007 +73 Methods 0 0 Messages 0 0 Branches 0 0 ========================================== + Hits 19438 19501 +63 - Misses 7496 7506 +10 Partials 0 0
Nice work! My only thought was whether we want to make 256 LRU-size configurable. But I couldn't think of jobid access patterns that can significantly benefit from more than 256 entries in the LRU... So this is good as is from what I can tell.
My gut feeling is same as @garlick. There would be other areas where caching with configurable policies and parameters would be useful... Along the similar line, I'm also thinking the red black trees etc that I have been looking at can find general use later on...