jono-morris commented on PR #12138:
URL: https://github.com/apache/camel/pull/12138#issuecomment-1923470646

   > > > Thank you all for the hard work improving Apache Camel!
   > > > I have a question about this change that I would like to ask.
   > > > With this new change, how are we going to set the rate limit (10 
req/sec) as specified by some API endpoints?
   > > > The new throttle EIP design doesn't seem to be practical since most 
APIs aren't designed with a rate limit of "max concurrent requests"?
   > > 
   > > 
   > > I think we, somehow, missed this valid question. I was looking at one of 
the emails on our user list and someone raised the very same question.
   > > @jono-morris, I think, maybe, we should complement the migration guide 
with this information or a guidance for some scenarios (such as - what to do 
when there is a need to rate limit it when the time slot is greater than 
1000msec and other use cases).
   > 
   > There were other questions about throttling and about the removal of 
timeoutPeriodmillis.. I think we should not remove that option.
   
   Firstly, sorry about the delay in responding.  I've taken away some 
learnings.
   
   About this change. 
   
   Previously the Throttler employed a fixed window algorithm, allowing a fixed 
number of calls in a particular period, e.g. 2 requests per minute.  This is 
susceptible to bursts in requests. For example, if the limit is set at 1000 
requests/hour, all 1000 requests might be made in the first minute of the 
window.
   
   With this in mind the algorithm was shifted to more of a leaky bucket 
implementation using a semaphore with a fixed number of permits.  Callers try 
to acquire a permit, blocking if necessary when all available permits have been 
acquired.  When a caller completes processing the permit it holds is released.  
This approach limits the number of concurrent requests, there is no notion of 
rate.
   
   Let's discuss and find the best way forward.
   


-- 
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: commits-unsubscr...@camel.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to