Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The Scala way to use one actor per socket connection

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.

like image 584
Stefan Avatar asked Mar 24 '10 13:03

Stefan


1 Answers

In the book "Programming Scala" the authors used a library called naggati which provides a framework that combines NIO and actors, http://programming-scala.labs.oreilly.com/ch09.html.

like image 137
mihannus Avatar answered Sep 30 '22 06:09

mihannus