Scala has essentially two types of participants (using standard Scala 2.8 participants): stream-based and event-based.
When you use receive (or receiveWithin ), as in your example, you create entities based on threads that are relatively heavyweight. There is a separate thread for each actor, which is blocked while the actor is waiting for a message.
When you use react instead of receive , your actor will be an event-based actor. Event-based actors are much lighter; there is no one-to-one communication between participants and event-based streams. You can easily create thousands of event-based contributors.
I wrote a more detailed blog post (and sample application).
source share