StevenLuMT commented on code in PR #3522:
URL: https://github.com/apache/bookkeeper/pull/3522#discussion_r997238546
##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/BookieImpl.java:
##########
@@ -112,8 +113,8 @@ public class BookieImpl extends BookieCriticalThread
implements Bookie {
private int exitCode = ExitCode.OK;
- private final ConcurrentLongHashMap<byte[]> masterKeyCache =
- ConcurrentLongHashMap.<byte[]>newBuilder().build();
+ private final Cache<Long, byte[]> masterKeyCache =
CacheBuilder.newBuilder().
+ expireAfterAccess(60, TimeUnit.MINUTES).build();
Review Comment:
@merlimat
### the purpose of this PR change:
The current replacement of ConcurrentLongHashMap is not because there is any
problem with ConcurrentLongHashMap, but because the current masterKeyCache has
not been cleaned up since bookie started
### How to optimize ConcurrentLongHashMap?
Please give some specific advice? All I can think of is to regularly clean
up the masterKeyCache logic. Now that guava cache has done this, there is no
need to do this implementation.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]