maedhroz commented on code in PR #3274:
URL: https://github.com/apache/cassandra/pull/3274#discussion_r1592923180
##########
src/java/org/apache/cassandra/transport/PreV5Handlers.java:
##########
@@ -172,20 +183,33 @@ private void checkLimits(ChannelHandlerContext ctx,
Message.Request request)
backpressure = Overload.BYTES_IN_FLIGHT;
}
+ long delay = -1;
+
if (DatabaseDescriptor.getNativeTransportRateLimitingEnabled())
{
// Reserve a permit even if we've already triggered
backpressure on bytes in flight.
- long delay =
GLOBAL_REQUEST_LIMITER.reserveAndGetDelay(RATE_LIMITER_DELAY_UNIT);
+ delay =
GLOBAL_REQUEST_LIMITER.reserveAndGetDelay(RATE_LIMITER_DELAY_UNIT);
// If we've already triggered backpressure on bytes in
flight, no further action is necessary.
if (backpressure == Overload.NONE && delay > 0)
- {
- pauseConnection(ctx);
-
- // A permit isn't immediately available, so schedule
an unpause for when it is.
- ctx.channel().eventLoop().schedule(() ->
unpauseConnection(ctx.channel().config()), delay, RATE_LIMITER_DELAY_UNIT);
backpressure = Overload.REQUESTS;
- }
+ }
+
+ if (backpressure == Overload.NONE &&
!dispatcher.hasQueueCapacity())
+ {
+ delay =
queueBackpressure.markAndGetDelay(RATE_LIMITER_DELAY_UNIT);
+
+ if (delay > 0)
+ backpressure = Overload.QUEUE_TIME;
+ }
+
+ if (delay > 0)
+ {
+ assert backpressure != Overload.NONE;
Review Comment:
nit: Should this be just asserting that backpressure isn't `NONE` or should
it be asserting that it's `REQUESTS` or `QUEUE_TIME`, which are the only things
that would have an associated delay?
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]