teshull / akka-bench

Benching Akka against various other concurrency libraries and approaches

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

================================
===Three different benchmarks===
================================

The project currently consists of different benchmarks. These three benchmarks 
stresses the actors very differently, which can be seen in the results in that 
which kind of execution strategies (schedulers/dispatchers) varies a lot between 
benchmarks.

==================================
===Build and Run the benchmarks===
==================================

All the six modules in the two benchmarks are build with SBT. 

Step into each module and invoke:
$ sbt update 
$ sbt run

This should download dependencies, build and run the benchmark and print out 
the results to the console.

========================
===Pipeline benchmark===
========================

--------------
Benchmark between:
* Akka 0.8.1 (Scala 2.8.0.Beta1)
* Scala Actors (Scala 2.8.0.Beta1)
* Jetlang (Java)

--------------
Description:

It originates from this article (which compares some more Java actor frameworks): 
http://sujitpal.blogspot.com/2009/01/more-java-actor-frameworks-compared.html

This benchmark consists of three stages 'Download -> Index -> Write' and tries 
to emulate a pipeline service.

Jetlang was chosen as Java implementation since it is widely known as the fastest 
and most scalable Java Actors library. It might be a matter of taste but I find 
both of the Actor implementations significantly more straightforward, clear and 
easy to understand.

--------------
Result doing 1 million requests:

Jetlang: 
~6.5 seconds

Akka with ThreadBasedDispatcher:
~8.5 seconds

Akka with ExecutorBasedEventDrivenDispatcher:
~11 seconds

Akka with ReactorBasedSingleThreadEventDrivenDispatcher:
~9 seconds

Scala Actors with 'react': 
~ 18 seconds

Scala Actors with 'receive': 
~ 13.5 seconds

=========================
===Chameneos benchmark===
=========================

--------------
Benchmark between:
* Akka 0.8.1 (Scala 2.8.0.Beta1)
* Scala Actors (Scala 2.8.0.Beta1)
* Thread/synchronized (Java)

--------------
Description: 

This benchmark originates from http://shootout.alioth.debian.org/.

It is not really fair to compare an idiomatic Actor-based implementation with 
the most brutal bare-bones thread-based implementation. If one looks at the Java 
thread-based implementation one can see that it sends 1 message to the global 
'MeetingPlace' which then performs all the logic under one single global lock, 
then directly accessing *public* variables (that I think should be private) in 
the different Chameneos. For each of these single messages the idiomatic Actor 
implementation sends 3 messages and lets each Chameneos actor update its state 
internally. Both of the Actor implementations (Akka and Scala Actors) are fairly 
clean conceptually and allows for refactoring, extensibility and reuse, something 
that can't be said for the Java thread implementation. But I think it is fair to 
say that Akka (with its ExecutorBasedEventDrivenDispatcher) is still performing 
surprisingly well.

--------------
Result doing 1 million messages:

Java Thread-based with single resource:
~ 1 second

Akka with ExecutorBasedEventDrivenDispatcher: 
~ 3.5 seconds

Akka with ThreadBasedDispatcher: 
~ 12.5 seconds

Scala Actors with 'react': 
~ 11 seconds

Scala Actors with 'receive': 
~ 21 seconds

==========================
===Token Ring benchmark===
==========================

--------------
Benchmark between:
* Akka 0.8.1 (Scala 2.8.0.Beta1)
* Scala Actors (Scala 2.8.0.Beta1)

--------------
Description:

Sends a token around a ring of 10 actors one million times.

--------------
Result:

TODO

About

Benching Akka against various other concurrency libraries and approaches


Languages

Language:Scala 58.4%Language:Java 41.6%