Benchmark: Akka vs Erlang
Franz Bettag have written up a small post about a benchmark between Akka and Erlang.
Interesting results. On his hardware and specific benchmark Erlang R14B04 did 1 million messages per second while Akka 2.0-SNAPSHOT did 2.1 million per second.
Read more here: http://uberblo.gs/2011/12/scala-akka-and-erlang-actor-benchmarks
…and we still have a lot more performance to squeeze out of Akka.
Location Transparency: Remoting in Akka 2.0
The remoting capabilities of Akka 2.0 are really powerful. Something that not has been as powerful is the documentation of the Akka remoting. We are constantly striving on improving it and this blog post will, hopefully, shed some light on the topic.
The remoting contains functionality not only to lookup a remote actor and send messages to it but also to deploy actors on remote nodes. These two types of interaction are referred to as:
- Lookup
- Creation
In the section below the two different approaches will be explained.
(It may be worth pointing out that a combination of the two ways is, of course, also feasible)
The Setup
In order to run the example code below the following jars must be available on your classpath:
- akka-actor.jar
- akka-remote.jar
The Configuration File
Firstly we’ll start off by examining the configuration file as it plays a pivotal part in the remoting. The remote section holds a lot of configuration possibilities but the bare minimum to get started is described in this section:
If you want to run multiple actor systems on the same machine you can group your settings like this:
Okay, so basically what you need to do to get started are four things:
- Make sure that the
akka.remote.RemoteActorRefProvideris used as provider - Add host name - the machine you want to run the actor system on
- Add port number - the port the actor system should listen on
- Add cluster node name - must be a unique name in the cluster
The above settings are enough for the lookup approach. In that case we only need to make sure the involved actor system run on a unique combination of host name and port.
Let’s say we are interested in testing the other approach, i.e. the creation functionality of remoting. This means that we have to add some information to the configuration file:
The configuration above instructs Akka to react specially once when an actor at path /actorName is created, i.e. using system.actorOf(Props(...), "actorName"). This specific actor will not only be instantiated, but instead the remote daemon of the remote system will be asked to create the actor instead,which is at actorSystem@127.0.0.1:2553 in this sample.
Lookup Approach in code
Let’s say you want to look up an actor on a remote node and use it. It’s really simple! Just do the following:context.actorFor("akka://ACTOR_SYSTEM@HOST:PORT/user/ACTOR_NAME")
where:
ACTOR_SYSTEMis the name of the actor system the actor exists inHOSTis the machine address, e.g.127.0.0.1PORTis the port number the actor system is configured to listen to, e.g. 2552ACTOR_NAMEis the name of the actor you want to use
The actor you want to use has to exist in the actor system and have the name associated with it. Here’s some example code how to set it up and try it out:
Creation Approach in code
In this section we will see how to create and use and actor on a remote node:
A fully fledged example of the two approaches can also be found here:
https://github.com/jboner/akka/tree/master/akka-samples/akka-sample-remote
Happy hAKKing
@h3nk3
Akka Team Blog Is Live
Stay tuned for more soon… :-P


