61yao commented on code in PR #10108: URL: https://github.com/apache/pinot/pull/10108#discussion_r1087525709
########## 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: I see what you meant. the read and write access will clean up expired entries. "larger than any query deadline" is your assumption. What's the downside of passing the actual 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