You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by bt...@apache.org on 2022/12/06 08:03:59 UTC

[james-project] 08/15: [PERF] Remove logger call in LockLessConcurrencyLimitingRequestThrottler

This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 9389ca477fd5ffc901e7c5c4971b9ae6c88fc56f
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Thu Nov 24 13:34:07 2022 +0700

    [PERF] Remove logger call in LockLessConcurrencyLimitingRequestThrottler
    
    ~10% CPU when submitting Cassandra requests, for a trace call reasonably not used in production.
---
 .../utils/LockLessConcurrencyLimitingRequestThrottler.java          | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/backends-common/cassandra/src/main/java/org/apache/james/backends/cassandra/utils/LockLessConcurrencyLimitingRequestThrottler.java b/backends-common/cassandra/src/main/java/org/apache/james/backends/cassandra/utils/LockLessConcurrencyLimitingRequestThrottler.java
index 54f1b6d6c4..af3cc408e4 100644
--- a/backends-common/cassandra/src/main/java/org/apache/james/backends/cassandra/utils/LockLessConcurrencyLimitingRequestThrottler.java
+++ b/backends-common/cassandra/src/main/java/org/apache/james/backends/cassandra/utils/LockLessConcurrencyLimitingRequestThrottler.java
@@ -69,18 +69,14 @@ public class LockLessConcurrencyLimitingRequestThrottler implements RequestThrot
     public void register(Throttled request) {
         int requestNumber = concurrentRequests.incrementAndGet();
         if (closed) {
-            LOG.trace("[{}] Rejecting request after shutdown", logPrefix);
             fail(request, "The session is shutting down");
         } else if (requestNumber < maxConcurrentRequests) {
             // We have capacity for one more concurrent request
-            LOG.trace("[{}] Starting newly registered request", logPrefix);
             request.onThrottleReady(false);
         } else if (requestNumber < maxQueueSize + maxConcurrentRequests) {
-            LOG.trace("[{}] Enqueuing request", logPrefix);
             queue.add(request);
         } else {
             concurrentRequests.decrementAndGet();
-            LOG.trace("[{}] Rejecting request because of full queue", logPrefix);
             fail(
                 request,
                 String.format(
@@ -105,7 +101,6 @@ public class LockLessConcurrencyLimitingRequestThrottler implements RequestThrot
         if (!closed) {
             if (queue.remove(request)) { // The request timed out before it was active
                 concurrentRequests.decrementAndGet();
-                LOG.trace("[{}] Removing timed out request from the queue", logPrefix);
             } else {
                 onRequestDone();
             }
@@ -117,7 +112,6 @@ public class LockLessConcurrencyLimitingRequestThrottler implements RequestThrot
             concurrentRequests.decrementAndGet();
             Throttled throttled = queue.poll();
             if (throttled != null) {
-                LOG.trace("[{}] Starting dequeued request", logPrefix);
                 throttled.onThrottleReady(true);
                 // don't touch concurrentRequests since we finished one but started another
             }


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org