Hacker News new | ask | show | jobs
High throughput Java actors--much faster than Akka
5 points by blaforge 5062 days ago
I worked in Scala for 2 years and was constantly frustrated with the speed of the actors. So I rolled my own, in Java. Orders of magnitude faster, though the speed increase really has nothing to do with the choice of language.

Most of the speed gain comes from avoiding thread switching as much as possible. I developed the idea of commandeering, where an actor which sends a message to another actor that is idle can safely process the message sent on the same thread.

Additional speedups came from message buffering and the optional use of 2-way messages for implicit flow control.

Message passing between actors runs between 80 and 200 million per second on an i7, depending on the mode of delivery.

Currently looking for early adopters as I believe this is production ready.

https://github.com/laforge49/JActor

2 comments

Sounds interesting, good luck!

Thread switching is certainly costly and not really necessary for high-performance systems as proved by the the LMAX/Disruptor architecture.

I'll admit it, the disruptor architecture was my inspiration.

I've since put together an in-memory database built on JActor that processes a million ACID transactions a second (on an i7 with ssd). https://github.com/laforge49/JFile

What I didn't like about the disruptor pattern is that it seems to require a lot of architecture, and I like to keep things as fluid as possible.

My proposal is that a high-throughput actor framwork (like JActor) is close to ideal for building vertically scalable server software.

Hey Guillaume, looks nice. I'll try to benchmark it against the famous Akka Pi.scala example.

Btw since, language is not important, why didn't you write this in Scala?

I had only 2 years of experience with Scala and was not always able to foresee the overhead of various language constructs. As this was my first project where I considered performance critical, I decided to stick with Java--with which I have decades of experience and a more in-depth understanding.