[infinispan-issues] [JBoss JIRA] (ISPN-1300) Reduce number of locks and buckets generated by BucketBasedCacheStore
Johann Burkard (JIRA)
jira-events at lists.jboss.org
Thu Jan 17 09:29:22 EST 2013
[ https://issues.jboss.org/browse/ISPN-1300?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12746419#comment-12746419 ]
Johann Burkard commented on ISPN-1300:
--------------------------------------
Sorry for digging this one up but I tried setting the maximum number of buckets to 4096 (for an ext3 file system) and that made Infinispan infinitely slower. When this is configurable, could this be done in a way that's free of side-effects?
> Reduce number of locks and buckets generated by BucketBasedCacheStore
> ---------------------------------------------------------------------
>
> Key: ISPN-1300
> URL: https://issues.jboss.org/browse/ISPN-1300
> Project: Infinispan
> Issue Type: Enhancement
> Components: Configuration, Loaders and Stores
> Affects Versions: 5.0.0.CR8
> Reporter: Robert Stupp
> Assignee: Manik Surtani
> Fix For: 5.0.0.FINAL
>
>
> The current implementation of FileCacheStore creates one bucket and lock for each hash key - which results in up to 4.2 billion files (2^32).
> It should limit the number of files to
> a) improve performance of purge
> b) reduce number of open file handles (system resources)
> c) reduce number of Java objects/heap (JVM resources)
> d) improve performance
> The implementation allows us to do so.
> Only 4 lines of code are necessary in BucketBasedCacheStore implementation:
> {code}
> private int hashKeyMask = 0xfffffc00; // TODO should get a configuration entry
> @Override
> protected Integer getLockFromKey(Object key) {
> return Integer.valueOf(key.hashCode() & hashKeyMask);
> }
> {code}
> This reduces the number of files to 2^22 = 4,194,304 files. Since each application and each cache store has different semantics the hasKeyMask value should be configurable - best would be to configure the number of bits.
> Side effect: If someone changes the FileCacheStore hasKeyMask, the whole cache store becomes unuseable. So I opened another enhancement ...
> Note: This implementation should be used in a different class (e.g. extend FileCacheStore) because it makes existing file cache stores unusable.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the infinispan-issues
mailing list