wenbingshen commented on code in PR #3846:
URL: https://github.com/apache/bookkeeper/pull/3846#discussion_r1137181222
##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/BookieRequestHandler.java:
##########
@@ -34,20 +40,24 @@
*/
@Slf4j
public class BookieRequestHandler extends ChannelInboundHandlerAdapter {
-
+ private static final int DEFAULT_CAPACITY = 1_000;
static final Object EVENT_FLUSH_ALL_PENDING_RESPONSES = new Object();
private final RequestProcessor requestProcessor;
private final ChannelGroup allChannels;
private ChannelHandlerContext ctx;
+ private final BlockingQueue<BookieProtocol.ParsedAddRequest> msgs;
private ByteBuf pendingSendResponses = null;
private int maxPendingResponsesSize;
BookieRequestHandler(ServerConfiguration conf, RequestProcessor processor,
ChannelGroup allChannels) {
this.requestProcessor = processor;
this.allChannels = allChannels;
+
+ int maxCapacity = conf.getMaxAddsInProgressLimit() > 0 ?
conf.getMaxAddsInProgressLimit() : DEFAULT_CAPACITY;
+ this.msgs = new ArrayBlockingQueue<>(maxCapacity);
Review Comment:
I'm not sure if it's going to happen, but I wanted to ask this question: Do
we need to add a byte size limit? How to prevent the channel from reading a
large amount of data from the socket and causing the OOM of the direct memory?
--
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]