chibenwa commented on a change in pull request #833:
URL: https://github.com/apache/james-project/pull/833#discussion_r781019716



##########
File path: src/adr/0051-email-rate-limiting.md
##########
@@ -0,0 +1,40 @@
+# Email rate limiting
+
+Date: 2021-01-10
+
+## Status
+
+// todo
+
+## Context
+
+Rate limiting is one of the common features. Examples: SaaS is one 
https://www.fastmail.help/hc/en-us/articles/1500000277382-Account-limits#sending/receiving,
 https://support.google.com/mail/answer/22839
+They limit how many emails you can send/receive from/to each email account 
over a given period of time.  
+We believe the rate-limiting will help James has more control of the resource 
and easy to dynamic config the user policy. It also complements the storage 
quota.
+
+## Decision
+
+- Set up a new maven project dedicated to rating limiting
+- Provide 2 criteria to limit to each duration: number of emails and total 
size of emails
+- This can be done via mailets:
+  - PerSenderRateLimit is per sender
+  - PerRecipientRateLimit is per recipient
+  - GlobalRateLimit for everyone
+Depending on the position in the pipeline this could allow rating limit all 
emails in transit, relayed emails or locally delivered emails.    
+The rate limit will be config in 
[mailetcontainer.xml](/server/apps/distributed-app/sample-configuration/mailetcontainer.xml).
+
+- Provide the interface `RateLimiter`, that will evaluate the current rate 
limit and return result acceptable or exceeded.
+- Create the implement InmemoryRateLimiter, which use guava-rate-limiter 
+- Create the implement RedisRateLimiter, which will use 
[Redis](https://redis.io) to store the current rate of each email. Use 
https://lettuce.io for the non-blocking Redis driver.

Review comment:
       Please state when to use in memroy rate limiter and when to use the 
redis one.
   
   Please state that one would be able to configure the implementation he 
wishes to use.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to