linagora / james-project

Mirror of Apache James Project
Apache License 2.0
70 stars 63 forks source link

Code for the heros: Better reactive JMAP... #5179

Closed chibenwa closed 2 months ago

chibenwa commented 2 months ago

XUserAuthenticationStrategy is blocking

Screenshot from 2024-05-02 10-47-56

Executed on blocking call wrapper.

To handle this well:

Current impact: blocking call wrapper in mobilised on each and every request because of this...

AliasReverseResolverImpl is blocking

The underlying RRT exposes iterables which are inherantly blocking.

recipientRewriteTable.listSources(...) actually is just a mere wrapper around a cassandra table and would be easy to reactify.

Then the overall algorithm could be reactified CF https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Flux.html#expand-java.util.function.Function-

This is called upon sending email (likely to be blocking anyway) but also listing identities which is not an uncommon request.

Screenshot from 2024-05-02 10-49-14

chibenwa commented 2 months ago

-> Those were identified doing wall clock profiling onto the JMAP pods

./profiler.sh -e wall -d 600 -t -i 1ms -I '*james*' -X '*JamesMailSpooler*' -X '*smtp*' -f /root/wall-jmap.html 1
chibenwa commented 2 months ago

See https://github.com/apache/james-project/pull/2228 for AliasReverseResolverImpl is blocking

chibenwa commented 2 months ago

See https://github.com/apache/james-project/pull/2235 for XUser