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 2025/09/14 21:29:00 UTC

[jira] [Closed] (JAMES-4093) IMAP: Basic traffic control

     [ https://issues.apache.org/jira/browse/JAMES-4093?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Benoit Tellier closed JAMES-4093.
---------------------------------
    Resolution: Fixed

> IMAP: Basic traffic control
> ---------------------------
>
>                 Key: JAMES-4093
>                 URL: https://issues.apache.org/jira/browse/JAMES-4093
>             Project: James Server
>          Issue Type: New Feature
>            Reporter: Benoit Tellier
>            Priority: Major
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> h2. Why?
> Several goals:
>  - Have tools to ensure fairness across users
>  - Have tools to prevent / mitigate network saturation
> This could help mitigating DOS, throttling painfull migrations in order to protect the underlying on-prem object store, etc...
> h2. What ?
> As an IMAP administrator I want to be able to set up optional Traffic shapping for IMAP, stating that for instance I limit each IMAP channel to a 1MB/s bandwith.
> Example configuration:
> {code:java}
> <imapserver enabled="true">
>     <jmxName>imapserver</jmxName>
>     <bind>0.0.0.0:0</bind>
>     <connectionBacklog>200</connectionBacklog>
>     <trafficShapping>
>         <incomingTrafficPerSecond>5MB</incomingTrafficPerSecond>
>         <outgoingTrafficPerSecond>5MB</incomingTrafficPerSecond>
>         <checkInterval>30s</checkInterval>
>         <maxDelays>30s</maxDelays>
>     </trafficShapping>
> </imapserver>
> {code}
> h2. How?
> Netty provides out of the box traffic shapping.
> Just insert ChannelTrafficShapingHandler part of the pipeline.
> CF https://netty.io/4.0/api/io/netty/handler/traffic/ChannelTrafficShapingHandler.html
> h2. Kisscool benefits
> Note that we might even be able to access traffic metrics and augment JAMES-4091 !
> {code:java}
> curl -XGET /servers/channels/btellier@apache.org
> [
>    {
>        "protocol": "IMAP",
>         "endpoint": "imap-ssl",
>         "encrypted": true, // SSLHandler part of the pipeline
>         "connectionDate": "2024-11-20T16:00:00Z", // Tracked via an attribute to set upon connection
>         "remoteAddress": "12.23.45.43:4378",
>         "isActive": true,
>         "username": "btellier@apache.org",
>         "protocolSpecificInformation": {
>              "userAgent": "outlook",
>              "compressed": "true", // CompressHandler part of the pipeline
>              "cumulativeWrittenBytes": "3357352863", 
>              "cumulativeReadBytes": "2442343434", 
>              "liveReadThroughputBytePerSecond": "345678", 
>              "liveWriteThroughputBytePerSecond": "344564", 
>              "lastRead": "2024-11-20T16:05:00Z", 
>              "lastWrite": "2024-11-20T16:07:00Z", 
>              "requestCount": "1234",  // channel attribute to be incremented on channelRead
>              "cumulativeReadBytes": "2442343434", 
>              "selectedMailbox": "INBOX", // Read the IMAPSession
>              "isIdling": "true",  // Inspect behavious in protocol overrides
>          }   
>    },
> ...
> ]
> {code}
> (channel.pipeline().get(TEFFIC_SHAPPER).trafficCounter())



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

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