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 ce1548d3812103731db4adef1d829ca07fd4930d Author: Benoit TELLIER <btell...@linagora.com> AuthorDate: Sat Dec 14 21:54:26 2024 +0100 [PERF] Allow lowering EMail/set range threshold If not in range mode, triggers one websocket notification per each message --- docs/modules/servers/partials/configure/jvm.adoc | 9 +++++++++ server/apps/distributed-app/sample-configuration/jvm.properties | 5 ++++- .../org/apache/james/jmap/method/EmailSetUpdatePerformer.scala | 5 +++-- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/docs/modules/servers/partials/configure/jvm.adoc b/docs/modules/servers/partials/configure/jvm.adoc index f6b5ce0ef2..15e409047b 100644 --- a/docs/modules/servers/partials/configure/jvm.adoc +++ b/docs/modules/servers/partials/configure/jvm.adoc @@ -100,6 +100,15 @@ james.jmap.reactor.netty.metrics.enabled=true ---- To enable the metrics. +== Set up JMAP EMail/set range threshold + +From which point should range operation be used? Defaults to 3. + +Ex in `jvm.properties`: +---- +james.jmap.email.set.range.threshold=3 +---- + == Enable S3 metrics James supports extracting some S3 client-level metrics e.g. number of connections being used, time to acquire an S3 connection, total time to finish a S3 request... diff --git a/server/apps/distributed-app/sample-configuration/jvm.properties b/server/apps/distributed-app/sample-configuration/jvm.properties index a5e6b4bc58..3b20e8ddc7 100644 --- a/server/apps/distributed-app/sample-configuration/jvm.properties +++ b/server/apps/distributed-app/sample-configuration/jvm.properties @@ -93,4 +93,7 @@ jmx.remote.x.mlet.allow.getMBeansFromURL=false # Count of octet from which hashing shall be done out of the IO threads in deduplicating blob store # james.deduplicating.blobstore.thread.switch.threshold=32768 # Count of octet from which streams are buffered to files and not to memory -# james.deduplicating.blobstore.file.threshold=10240 \ No newline at end of file +# james.deduplicating.blobstore.file.threshold=10240 + +# From which point should range operation be used? Defaults to 3. +# james.jmap.email.set.range.threshold=3 \ No newline at end of file diff --git a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/EmailSetUpdatePerformer.scala b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/EmailSetUpdatePerformer.scala index 6655321bb0..484e2f3fb2 100644 --- a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/EmailSetUpdatePerformer.scala +++ b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/EmailSetUpdatePerformer.scala @@ -27,7 +27,7 @@ import org.apache.james.jmap.core.SetError.SetErrorDescription import org.apache.james.jmap.json.EmailSetSerializer import org.apache.james.jmap.mail.KeywordsFactory.LENIENT_KEYWORDS_FACTORY import org.apache.james.jmap.mail.{EmailSet, EmailSetRequest, MailboxIds, UnparsedMessageId, ValidatedEmailSetUpdate} -import org.apache.james.jmap.method.EmailSetUpdatePerformer.{EmailUpdateFailure, EmailUpdateResult, EmailUpdateResults, EmailUpdateSuccess} +import org.apache.james.jmap.method.EmailSetUpdatePerformer.{EmailUpdateFailure, EmailUpdateResult, EmailUpdateResults, EmailUpdateSuccess, RANGE_THRESHOLD} import org.apache.james.mailbox.MessageManager.FlagsUpdateMode import org.apache.james.mailbox.exception.{MailboxNotFoundException, OverQuotaException} import org.apache.james.mailbox.model.{ComposedMessageIdWithMetaData, MailboxId, MessageId, MessageRange} @@ -40,6 +40,7 @@ import scala.jdk.CollectionConverters._ object EmailSetUpdatePerformer { private val LOGGER = LoggerFactory.getLogger(classOf[EmailSetUpdatePerformer]) + private val RANGE_THRESHOLD = Option(System.getProperty("james.jmap.email.set.range.threshold")).map(s => s.toInt).getOrElse(3) trait EmailUpdateResult case class EmailUpdateSuccess(messageId: MessageId) extends EmailUpdateResult case class EmailUpdateFailure(unparsedMessageId: UnparsedMessageId, e: Throwable) extends EmailUpdateResult { @@ -127,7 +128,7 @@ class EmailSetUpdatePerformer @Inject() (serializer: EmailSetSerializer, val sameUpdate: Boolean = validUpdates.map(_._2).distinctBy(_.update).size == 1 val singleMailbox: Boolean = metaData.values.flatten.map(_.getComposedMessageId.getMailboxId).toSet.size == 1 - if (sameUpdate && singleMailbox && validUpdates.size > 3) { + if (sameUpdate && singleMailbox && validUpdates.size > RANGE_THRESHOLD) { val update: ValidatedEmailSetUpdate = validUpdates.map(_._2).headOption.get val ranges: List[MessageRange] = asRanges(metaData) val mailboxId: MailboxId = metaData.values.flatten.map(_.getComposedMessageId.getMailboxId).headOption.get --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org