Derek,
thanks for your comments!
> Just to add to this, Akka's IOManager was written at a high enough level so it could run on any Akka dispatcher, without needing to manage it's own thread.
> It was originally implemented with it's own thread, but both myself and Viktor Klang found it to not be very 'Akka-like'.
Yes, I assumed that your goal was to pay a certain price in terms of performance and implementation complexity for the advantage of having the IOManager be a regular Actor. This way it is a good Akka citizen and benefits of all the perks regular Actors enjoy now (and in the future).
sprays IO implementation also tries to be "Akka-like", but in the sense of "fighting for every allocation" and reducing overhead to the minimum in order to deliver max performance (while still upholding a "good" architecture). We have decided to sacrifice "being an Actor" on this altar.
The current prime beneficiary of this is the spray-can HTTP server, which is built on top of spray-io and should be one of the fastest web servers on the JVM.
(Event though there is certainly some optimization potential left in the spray-io implementation... Our goal is to capture it all eventually.)
> This is also reflected in the decision to make sure that all data going to/from the IOManager was immutable, even though to create the fastest IO implementation possible you'd need to be working the the buffers directly.
Right. This is another area where spray-io differs from "akka-io".
There are more. For example, the Akka IOManagerActor employs a number of mutable maps to associate things like SelectableChannel and WriteBuffers with a connection handle. Since these maps are queried and updated in various places in the "hot path" they can add measurable overhead (cycles, memory), especially when the IOManager has to deal with tens of thousands of connections.
sprays IOBridge implementation doesn't use a single map, all required association of support structures happens through selector key attachments.
On the other hand "akka-io" appears to also support file IO rather than just network IO (which is what spray currently limits itself to).
So, on the bottom line it appears as if our two teams have made a number of slightly different design choices that give our users two sufficiently different implementations of an adapter layer between NIO events/commands and Akka Actor messages.
In the short-term the main job that is left for us to do on the spray side is to properly document our contraption, thereby also contrasting it with "akka-io", so that our users are aware of the differences and able to make a conscious and informed choice.
> --
>
>