Hi,

Two things, system.actorOf is a more costly operation than context.actorOf just 
synchronization wise, and having a very large number of children at the user 
level (there is a guardian actor that sits on top of the user level), can make 
other operations slower, like matching actor paths when using actor selection.

B/

On 26 September 2014 at 12:49:43, Idris Mokhtarzada ([email protected]) wrote:

Can someone elaborate on this part of Patrik's response? 

Creating many top level actors, concurrently, isn't recommended

Why is that not recommended?  What are the downsides?


On Monday, June 11, 2012 8:11:33 AM UTC+2, Patrik Nordwall wrote:


11 jun 2012 kl. 02:28 skrev dimgel <[email protected]>:

Hi all,

Since actors are stateful, I have to create an actor tree for each HTTP request 
I handle, right?

That depends on what you do in the actors. An actor can also be stateless and 
reused for each req. Note that an actor instance process only one message at a 
time, so for processing http requests it makes sense to create a new for each 
request or use a router (see docs) with a pool of actors that process the 
requests.

Creating many top level actors, concurrently, isn't recommended so in case you 
decide to create a new actor for each req you should delegate to fixed actor 
that creates the actor and forwards the req.


Have I to create ActorSystem for each request too,
No. ActorSystem is rather heavyweight. It creates thread pools etc.

or I can create the only one in Servlet.init(), reuse it for all (possibly 
concurrent) requests, and shut it down in Servlet.destroy()?

Yes


Is there any recommended way of generating unique ActorSystem names if each 
request needs its own ActorSystem, or unique Actor names otherwise? (AFAIK 
names are optional and that's OK for standalone server, but anyway maybe 
someone came upon some guidelines about naming in distributed environment.)

Thanks. =)
--
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/akka-user/-/cyCBgntIxkIJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at 
http://groups.google.com/group/akka-user?hl=en.
--
>>>>>>>>>> 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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

-- 
Björn Antonsson
Typesafe – Reactive Apps on the JVM
twitter: @bantonsson

-- 
>>>>>>>>>>      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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to