If it is used in blocking Spring controllers it would not matter, but you
should not use it inside of an actor for example.

With async, and possibly in general, it would probably be better to detect
to many concurrent requests and respond with some form of
service-overloaded status to the HTTP request. If done by just queueing up
requests (or blocking the incoming thread) and you have a consistent higher
inflow of requests than the limited rate those queued requests may fill up
your heap and crash the JVM or make the HTTP endpoint unavailable by taking
up all the threads.

--
Johan
Akka Team

On Tue, Aug 8, 2017 at 4:37 PM, Damien Gallagher <damien.gallag...@gmail.com
> wrote:

> Would you recommend not using this then so Richard?
>
>
> On Tuesday, August 8, 2017 at 3:34:37 PM UTC+1, richard wrote:
>>
>> A quick glance at the code indicates that the RateLimiter is blocking on
>> a timer, which is an Akka antipattern.
>>
>> The documentation also includes this line
>>
>>>  rateLimiter.acquire(); // may wait
>>>
>>>
>> https://github.com/google/guava/blob/master/guava/src/com/
>> google/common/util/concurrent/RateLimiter.java
>>
>>
>> On Tuesday, August 8, 2017 at 8:34:21 AM UTC-5, Damien Gallagher wrote:
>>>
>>> Thanks Rob
>>>
>>> On Tuesday, August 8, 2017 at 2:17:09 PM UTC+1, Rob Crawford wrote:
>>>>
>>>> The code using it has been in production for three years, and hasn't
>>>> seen any issues with it.
>>>>
>>>> On Tuesday, August 8, 2017 at 7:05:59 AM UTC-4, Damien Gallagher wrote:
>>>>>
>>>>> Hi Rob
>>>>>
>>>>> Is there any concern with this library being marked as a Beta library?
>>>>>
>>>>> Thanks
>>>>> Damien
>>>>>
>>>>> On Friday, July 21, 2017 at 9:25:04 PM UTC+1, Rob Crawford wrote:
>>>>>>
>>>>>> Take a look at Guava's RateLimiter class. I've used it for
>>>>>> controlling the rate at which a web service was called, and it worked
>>>>>> perfectly.
>>>>>>
>>>>>> On Monday, July 17, 2017 at 7:15:26 AM UTC-4, Damien Gallagher wrote:
>>>>>>>
>>>>>>> Hi
>>>>>>>
>>>>>>> I have a java 8 Spring based project that I want to use akka in.
>>>>>>>
>>>>>>> I have my RestControllers calling out to service classes.
>>>>>>> Some of these service classes call out to third party web services
>>>>>>> that have throttling requirements.
>>>>>>>
>>>>>>> Basically I want to throttle calls to the service classes from my
>>>>>>> Rest Controllers using Akka streams.
>>>>>>>
>>>>>>> 1. Is this use case possible?
>>>>>>> 2. If not - would you recommend a different way of doing this
>>>>>>> (unfortunately I wouldnt get the time to change all my rest services to 
>>>>>>> use
>>>>>>> the Akka http module)
>>>>>>> 3. If possible - can someone provide a quick code sample on how to
>>>>>>> implement this?
>>>>>>>
>>>>>>> Thank you
>>>>>>> Damien
>>>>>>>
>>>>>>>
>>>>>>> --
> >>>>>>>>>> Read the docs: http://akka.io/docs/
> >>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/
> current/additional/faq.html
> >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
> ---
> You received this message because you are subscribed to the Google Groups
> "Akka User List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to akka-user+unsubscr...@googlegroups.com.
> To post to this group, send email to akka-user@googlegroups.com.
> Visit this group at https://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to