HDFS-16257. Set initialCapacity for guava cache to solve performance issue (#3524)

* HDFS-16257. Set initialCapacity for guava cache to solve performance issue

* HDFS-16257. Add comments

Co-authored-by: Symious <yiyang0203@gmail.com>
This commit is contained in:
Symious 2021-10-18 18:58:00 +08:00 committed by GitHub
parent 2565ec5804
commit b7bb43f6db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -138,6 +138,9 @@ public class MountTableResolver
FEDERATION_MOUNT_TABLE_MAX_CACHE_SIZE,
FEDERATION_MOUNT_TABLE_MAX_CACHE_SIZE_DEFAULT);
this.locationCache = CacheBuilder.newBuilder()
// To workaround guava bug https://github.com/google/guava/issues/1055
// Fixed since guava 13.0
.initialCapacity(maxCacheSize)
.maximumSize(maxCacheSize)
.build();
} else {