Uploaded image for project: 'James Server'
  1. James Server
  2. JAMES-3711

Have a Requeue mailet that could be use in combinason with rate limiter to build a naive throttler

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 3.7.0
    • Mailet Contributions
    • None

    Description

      • 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:

      <mailet matcher="All" class="Requeue">
         <queue>spool</spool>
         <processor>transport</processor>
         <delay>2h</delay>
      </mailet>
      

      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.

      <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>
      

      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

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              btellier Benoit Tellier
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 2h 20m
                  2h 20m