You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by "Benoit Tellier (Jira)" <se...@james.apache.org> on 2022/01/28 09:23:00 UTC

[jira] [Created] (JAMES-3711) Have a Requeue mailet that could be use in combinason with rate limiter to build a naive throttler

Benoit Tellier created JAMES-3711:
-------------------------------------

             Summary: Have a Requeue mailet that could be use in combinason with rate limiter to build a naive throttler
                 Key: JAMES-3711
                 URL: https://issues.apache.org/jira/browse/JAMES-3711
             Project: James Server
          Issue Type: Bug
          Components: Mailet Contributions
            Reporter: Benoit Tellier


 - Requeue mailet allows specifying:
    - a Mail Queue name (optional, default to spool)
    - a target processor (optional, defaults to root)
    - a delay (optional, defaults to none)

Eg:

{code:java}
<mailet matcher="All" class="Requeue">
   <queue>spool</spool>
   <processor>transport</processor>
   <delay>2h</delay>
</mailet>
{code}

This is a generic enough functionality that I think it can make sense by itself.

Combined with rate limiting mailet, it allows for a (very basic) throtler: smooth the traffic to the expected rate. Note that this is a naive approach: if you have a large amout of emails (say N) submitted at once, you would need O(N) requeues to eventually send all your mails, where the constant is the number of mail allowed over the time window. So this gives an overall complexity of O(N2), while careful planning could achieve this in O(N).

Eg: throttle senders to 10 mails per hour, smoothing the traffic as required.

{code:java}
<processor name="root">
    <mailet matcher="All" class="PerSenderRateLimit">
        <redisURL>redis://localhost:6379</redisURL>
        <keyPrefix>myPrefix</keyPrefix>
        <duration>1h</duration>
        <count>10</count>
    </mailet>
    <!-- Go to transport for instance -->
</processor>

<processor name="root">
    <mailet matcher="All" class="Requeue">
        <queue>spool</spool>
        <processor>root</processor>
        <delay>1h</delay>
    </mailet>
</processor>
{code}

*TODO:*

 - [ ] Write the JIRA ticket for throttling
 - [ ] Write the Requeue mailet (`server/mailet/mailets`)
 - [ ] And finally provide documentation and config samples for this naive throttler



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

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