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/03/21 04:54:56 UTC

[james-project] branch master updated (ba2b808 -> b1beff3)

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

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


    from ba2b808  JAMES-3715 Add IMAP IDLE tests when combined with SSL, COMPRESS
     new 7086c72  [PERF] Naming threads: ElasticSearch driver threads should be named
     new 929e95d  [PERF] Naming threads: RabbitMQ driver threads should be named
     new b1beff3  [PERF] Naming threads: Spooler threads should be named

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../org/apache/james/backends/es/v7/ClientProvider.java    |  3 +++
 .../james/backends/rabbitmq/RabbitMQConnectionFactory.java |  2 ++
 .../james/mailetcontainer/impl/JamesMailSpooler.java       | 14 ++++++++++++--
 3 files changed, 17 insertions(+), 2 deletions(-)

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


[james-project] 01/03: [PERF] Naming threads: ElasticSearch driver threads should be named

Posted by bt...@apache.org.
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 7086c721c2b6ed9430e44b76b70e0b4bae2de3b2
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Fri Mar 18 11:09:39 2022 +0700

    [PERF] Naming threads: ElasticSearch driver threads should be named
---
 .../src/main/java/org/apache/james/backends/es/v7/ClientProvider.java  | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/backends-common/elasticsearch-v7/src/main/java/org/apache/james/backends/es/v7/ClientProvider.java b/backends-common/elasticsearch-v7/src/main/java/org/apache/james/backends/es/v7/ClientProvider.java
index b7d7a40..957638a 100644
--- a/backends-common/elasticsearch-v7/src/main/java/org/apache/james/backends/es/v7/ClientProvider.java
+++ b/backends-common/elasticsearch-v7/src/main/java/org/apache/james/backends/es/v7/ClientProvider.java
@@ -48,6 +48,7 @@ import org.apache.james.backends.es.v7.ElasticSearchConfiguration.HostScheme;
 import org.apache.james.backends.es.v7.ElasticSearchConfiguration.SSLConfiguration.HostNameVerifier;
 import org.apache.james.backends.es.v7.ElasticSearchConfiguration.SSLConfiguration.SSLTrustStore;
 import org.apache.james.backends.es.v7.ElasticSearchConfiguration.SSLConfiguration.SSLValidationStrategy;
+import org.apache.james.util.concurrent.NamedThreadFactory;
 import org.elasticsearch.client.RestClient;
 import org.elasticsearch.client.RestHighLevelClient;
 import org.slf4j.Logger;
@@ -75,6 +76,8 @@ public class ClientProvider implements Provider<ReactorElasticSearchClient> {
             configureHostScheme(builder);
             configureTimeout(builder);
 
+            builder.setThreadFactory(NamedThreadFactory.withName("ElasticSearch-driver"));
+
             return builder;
         }
 

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


[james-project] 03/03: [PERF] Naming threads: Spooler threads should be named

Posted by bt...@apache.org.
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 b1beff3e0b780a227f90aa3e12eca3ab7ecaac16
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Fri Mar 18 11:10:21 2022 +0700

    [PERF] Naming threads: Spooler threads should be named
    
    Apply a pattern similar to the one of DeliveryRunnable
---
 .../james/mailetcontainer/impl/JamesMailSpooler.java       | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/server/mailet/mailetcontainer-impl/src/main/java/org/apache/james/mailetcontainer/impl/JamesMailSpooler.java b/server/mailet/mailetcontainer-impl/src/main/java/org/apache/james/mailetcontainer/impl/JamesMailSpooler.java
index 47f88fa..d0e23a3 100644
--- a/server/mailet/mailetcontainer-impl/src/main/java/org/apache/james/mailetcontainer/impl/JamesMailSpooler.java
+++ b/server/mailet/mailetcontainer-impl/src/main/java/org/apache/james/mailetcontainer/impl/JamesMailSpooler.java
@@ -19,6 +19,8 @@
 
 package org.apache.james.mailetcontainer.impl;
 
+import static reactor.core.scheduler.Schedulers.DEFAULT_BOUNDED_ELASTIC_QUEUESIZE;
+
 import java.io.IOException;
 import java.util.Optional;
 import java.util.concurrent.atomic.AtomicInteger;
@@ -59,6 +61,7 @@ import com.google.common.collect.ImmutableList;
 
 import reactor.core.publisher.Flux;
 import reactor.core.publisher.Mono;
+import reactor.core.scheduler.Scheduler;
 import reactor.core.scheduler.Schedulers;
 
 /**
@@ -67,6 +70,8 @@ import reactor.core.scheduler.Schedulers;
  * them from the spool when processing is complete.
  */
 public class JamesMailSpooler implements Disposable, Configurable, MailSpoolerMBean {
+
+
     private static class Runner {
         private final AtomicInteger processingActive = new AtomicInteger(0);
         private final MetricFactory metricFactory;
@@ -75,6 +80,7 @@ public class JamesMailSpooler implements Disposable, Configurable, MailSpoolerMB
         private final reactor.core.Disposable disposable;
         private final MailQueue queue;
         private final Configuration configuration;
+        private final Scheduler scheduler;
 
         private Runner(MetricFactory metricFactory, GaugeRegistry gaugeRegistry, MailProcessor mailProcessor,
                        MailRepository errorRepository, MailQueue queue, Configuration configuration) {
@@ -84,6 +90,9 @@ public class JamesMailSpooler implements Disposable, Configurable, MailSpoolerMB
             this.queue = queue;
             this.configuration = configuration;
 
+            scheduler = Schedulers.newBoundedElastic(configuration.getConcurrencyLevel() + 1, DEFAULT_BOUNDED_ELASTIC_QUEUESIZE,
+                "spooler");
+
             this.disposable = run(queue);
 
             gaugeRegistry.register(SPOOL_PROCESSING + ".inFlight",
@@ -92,9 +101,9 @@ public class JamesMailSpooler implements Disposable, Configurable, MailSpoolerMB
 
         private reactor.core.Disposable run(MailQueue queue) {
             return Flux.from(queue.deQueue())
-                .flatMap(item -> handleOnQueueItem(item).subscribeOn(Schedulers.elastic()), configuration.getConcurrencyLevel())
+                .flatMap(item -> handleOnQueueItem(item).subscribeOn(scheduler), configuration.getConcurrencyLevel())
                 .onErrorContinue((throwable, item) -> LOGGER.error("Exception processing mail while spooling {}", item, throwable))
-                .subscribeOn(Schedulers.elastic())
+                .subscribeOn(scheduler)
                 .subscribe();
         }
 
@@ -187,6 +196,7 @@ public class JamesMailSpooler implements Disposable, Configurable, MailSpoolerMB
                 LOGGER.debug("error closing queue", e);
             }
             LOGGER.info("thread shutdown completed.");
+            scheduler.dispose();
         }
 
         public int getCurrentSpoolCount() {

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


[james-project] 02/03: [PERF] Naming threads: RabbitMQ driver threads should be named

Posted by bt...@apache.org.
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 929e95d42cf545be25d3672f63868b24b9245144
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Fri Mar 18 11:09:48 2022 +0700

    [PERF] Naming threads: RabbitMQ driver threads should be named
---
 .../org/apache/james/backends/rabbitmq/RabbitMQConnectionFactory.java   | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/backends-common/rabbitmq/src/main/java/org/apache/james/backends/rabbitmq/RabbitMQConnectionFactory.java b/backends-common/rabbitmq/src/main/java/org/apache/james/backends/rabbitmq/RabbitMQConnectionFactory.java
index 349bb82..140618c 100644
--- a/backends-common/rabbitmq/src/main/java/org/apache/james/backends/rabbitmq/RabbitMQConnectionFactory.java
+++ b/backends-common/rabbitmq/src/main/java/org/apache/james/backends/rabbitmq/RabbitMQConnectionFactory.java
@@ -39,6 +39,7 @@ import javax.net.ssl.SSLContext;
 import org.apache.commons.lang3.NotImplementedException;
 import org.apache.http.ssl.SSLContextBuilder;
 import org.apache.http.ssl.TrustStrategy;
+import org.apache.james.util.concurrent.NamedThreadFactory;
 
 import com.google.common.collect.ImmutableList;
 import com.rabbitmq.client.Address;
@@ -66,6 +67,7 @@ public class RabbitMQConnectionFactory {
     private ConnectionFactory from(RabbitMQConfiguration rabbitMQConfiguration) {
         try {
             ConnectionFactory connectionFactory = new ConnectionFactory();
+            connectionFactory.setThreadFactory(NamedThreadFactory.withName("rabbitmq-driver"));
             connectionFactory.setUri(rabbitMQConfiguration.getUri());
             connectionFactory.setHandshakeTimeout(rabbitMQConfiguration.getHandshakeTimeoutInMs());
             connectionFactory.setShutdownTimeout(rabbitMQConfiguration.getShutdownTimeoutInMs());

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