The Scala way to use one actor per socket connection

Posted by Stefan on Stack Overflow See other posts from Stack Overflow or by Stefan
Published on 2010-03-24T13:50:34Z Indexed on 2010/03/24 13:53 UTC
Read the original article Hit count: 163

Filed under:
|
|
|

I am wondering how it is possible to avoid one socket connection pr. thread in Scala. I have thought a lot about it, but I always end up with some code which is listening for incoming data for each client connection.

The problem is that I want to develop an application which should simultanously handle perhaps a couple of thousand connections. However I will of course not want to create a thread for each connection because of the lack of scalability and context switching.

What would be the "right" way to do this. In my world it should be possible to have one actor for each connection without the need to block one thread per actor.

© Stack Overflow or respective owner

Related posts about scala

Related posts about actors