Benoit Tellier created JAMES-4140:
-------------------------------------

             Summary: Ability to shape IMAP applicative traffic
                 Key: JAMES-4140
                 URL: https://issues.apache.org/jira/browse/JAMES-4140
             Project: James Server
          Issue Type: Improvement
          Components: IMAPServer
            Reporter: Benoit Tellier


h2. Why?

Some clients (Outlook) resynchronizes with an infinite loop on folders, 
SELECTing them all one by one.

This naive implementation results in an absurdly high workload.

Optimizing the given commands would not be a solution as it would only result 
in a higher workload as requests would be even more frequent.

Additionnally, being able to regulate traffic, imposing delays to clients that 
exceeds their QoS, seems like a desirable feature of a production-ready email 
server.

h2. How?

Implement a Netty ChannelInboundHandlerAdapter to be placed between IMAP 
command parsing and execution adding delays prior command execution as needed.

h3. Configuration proposal

The user can declare the list of commands on which throttling needs to be 
tracked and for each:

 - `thresholdCount`: below this number of occurrence, no throttling is applied. 
Integer.
 - `additionalDelayPerOperation`: delay to be applied when exceeding the 
threshold. The delay is cumulative and thus
 would always increase. Duration.
 - `observationPeriod`: the count of observed commands is reset after this 
period thus stopping delays. Duration.
 - `maxDelay`: maximum value the client will be delayed for.

Sample configuration:

{code:xml}
<imapserver>
  <!-- ... -->
  <perSessionCommandThrottling>
    <select>
      <thresholdCount>25</thresholdCount>
      <additionalDelayPerOperation>2ms</additionalDelayPerOperation>
      <observationPeriod>10m</observationPeriod>
      <maxDelay>1s</maxDelay>
    </select>
    <append>
      <thresholdCount>5</thresholdCount>
      <additionalDelayPerOperation>10ms</additionalDelayPerOperation>
      <observationPeriod>5m</observationPeriod>
      <maxDelay>2s</maxDelay>
    </append>
  </perSessionCommandThrottling>
</imapserver>
{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to