Thanks for the response! Sorry for the late reply..
On 24/05/2012, at 3:11 AM, Björn Antonsson wrote:
> Hi Antony,
>
> On Wednesday, 23 May 2012 at 07:10, Antony Stubbs wrote:
>> Have read HttpConcurrencyTestStress, done some searching and have been thinking about this, is it not possible to have an actor created dynamically for every incoming request, from the camel engine side of things? We have the same issue with JMS consumers, but that case is a little different. We know we only need to be able to handle 2 or 3 concurrent messages, and for that it's simple to just create 3-5 JMS consumers, but for incoming HTTP it's a little different.
>>
>> Doing it through a single akka-camel endpoint actor seems like a bottle neck (i.e. 8 jetty threads or whatever ending up putting messages onto 1 actor mailbox)
>>
>> Doing it with a single actor, dispatching to working actors, seems like you need an upper bound on the worker actors. (unless i'm missing a router that doesn't have an upper bound on actors and will create them on demand for every message? Our consumer end point creates new worker actors for every request)
>>
>> Am I missing something here, or is not the part of the point to be able to have actor to serve every inbound connection? (instead of a single actor bottleneck and an upper bound on worker actors, or on demand workers).
>>
>> We currently create a new actor for every request, without using router, but this still all goes through a single end point actor (however fast that may be). I thought maybe you can create multiple end point consumer actors for the same url (maybe, haven't tried, not sure if the camel/akka stuff can dynamically distribute if there are multiple matching consumers), but then you're still guessing on a quantity and setting an upper bound.
>>
>> Is there some config I'm missing that tells the akka/camel system to create as many actors as need to service incoming request, without going through a single actor router?
>
> I'm not sure that the single actor creating an actor for each request is a bottleneck. Have you got any figures proving this?
Not at all. Just the concept of 8 threads, talking to 1 thread, which then distributes out to n threads again. Seems like the 8 to 1 step could be avoidable.
> If you want to have multiple actors servicing the incoming requests, you could use a RoundRobinRouter with the number of instances set to for example the number of Jetty threads. You could then let each of these actors create a worker for each request, and let that worker handle the request.
Right, but isn't there still a step where there's one thread processing all incoming requests in order to distribute to the RRR?
> A short explanation about routers:
>
> The router is not an actor in itself, it is just a grouping of actors.
>
> The routing decision code will be executed concurrently by incoming message sends.
Ah - this may be the key bit of explanation I'm missing. Is this discussed in the documentation for Routers, and I missed it?
> A router does not create actors on demand at message sends but resizes itself at certain intervals based on the Resizer.
Is there a Resizer that has no upper limit? I suppose a very large upper limit would be more sensible instead..