ankitsultana commented on code in PR #10108: URL: https://github.com/apache/pinot/pull/10108#discussion_r1087494527
########## pinot-query-runtime/src/main/java/org/apache/pinot/query/mailbox/GrpcMailboxService.java: ########## @@ -44,16 +48,17 @@ * </ul> */ public class GrpcMailboxService implements MailboxService<TransferableBlock> { + private static final Duration MAILBOX_CACHE_EXPIRY = Duration.ofMinutes(5); // channel manager private final ChannelManager _channelManager; private final String _hostname; private final int _mailboxPort; // maintaining a list of registered mailboxes. - private final ConcurrentHashMap<String, ReceivingMailbox<TransferableBlock>> _receivingMailboxMap = - new ConcurrentHashMap<>(); - private final ConcurrentHashMap<String, SendingMailbox<TransferableBlock>> _sendingMailboxMap = - new ConcurrentHashMap<>(); + private final Cache<String, ReceivingMailbox<TransferableBlock>> _receivingMailboxCache = + CacheBuilder.newBuilder().expireAfterAccess(MAILBOX_CACHE_EXPIRY.toMinutes(), TimeUnit.MINUTES).build(); Review Comment: @61yao how does it "not work"? The periodic cache maintenance tasks are run on writes or occasionally during reads. Only if the cache is not accessed for a few hours would the entry not be cleaned in time. Instead of a Guava cache we could consider using a different strategy but since this is only temporary I weighed on the side of introducing as little temporary code as possible. > Also the cleanup thread needs to be tied with query deadline. I have set the expiry to 5 minutes which should be larger than any query deadline. -- 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: commits-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org