camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brad Johnson <brad.john...@mediadriver.com>
Subject Re: Limit Concurrent Access
Date Sat, 01 Oct 2016 17:42:30 GMT
The first question I'd have is "are you sure you have a problem with the
number of incoming requests?"  One of the biggest problems I find in the
field is premature optimization. If you have a fairly good characterization
of the problem, the number of requests anticipated, the length of time to
process the incoming request, etc. you can set up JMeter to stress test
your application.  That will let you change configuration options in Camel
and see if the response is more in line with what you are expecting.

What exactly are you trying to accomplish by limiting concurrent requests?
What do you want to happen if there are too many requests? Are these
request/responses that you are getting and sending data back after some
length operations or are you mostly receiving data to be processed and then
sending an "OK" response back.  In the case of the latter you can put the
incoming data on a SEDA queue and immediately return an "OK".  Is it that
the incoming request is resulting in a lot of number crunching, database
calls, or other operations that take too long and the number of requests
are bogging things down before sending a response back to the user?

Camel has a wide range of components that can provide RESTful APIs.  They
are all going to be a little different in their behavior.  For example, the
Netty component is going to use NIO under the covers to handle incoming
data.
http://camel.apache.org/rest-dsl.html

If you use Jetty you can look at the min and max settings on the thread
pool. Jetty also has continuations which frees up the incoming request
threads and uses a callback mechanism to send the response back when it is
finished.
http://camel.apache.org/jetty.html

But really, a bit more detail and code about the use case and what it is
you're trying to do would be helpful.  Do you want the request to send an
error to the client if there are too many incoming requests? Why is the
number of concurrent requests a concern?  Is the incoming data large chunks
of data that are gobbling up memory or is the processing expensive or ???.

On Sat, Oct 1, 2016 at 9:43 AM, Debraj Manna <subharaj.manna@gmail.com>
wrote:

> Hi
>
> I have seen Throttler <http://camel.apache.org/throttler.html> in camel.
> Is
> there anything available in camel that restricts the number of concurrent
> accesses something like this as mentioned here
> <https://github.com/google/guava/blob/master/guava/src/
> com/google/common/util/concurrent/RateLimiter.java#L41>
> ?
>
> Also  the below seems to be a more generic query but thought of asking here
> if anyone can provide some thoughts on this:-
>
> I have observed that most of the RESP APIs does rate limiting on requests
> rather than restricting the number of concurrent requests. Is there any
> specific reason?
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message