Presentation Fork/Join and Akka (part 2/2)


Additionally, we look at Akka, a cutting edge Scala library (which also comes with an explicitly supported Java API) for highly concurrent systems. Akka 2.0 offers many tools in the concurrency toolbox ranging from actors to dataflow concurrency.
Published on: 2012-05-07T18:49:20.000Z
Channel: BeJUG (all)
Tags: forkjoin concurrency akka
Speakers:

Sander Mak


Sander studeerde Software Technology aan de Universiteit Utrecht en is momenteel werkzaam als software architect bij Info Support BV. Hij blogt sinds maart 2012 op http://branchandbound.net over software development in het JVM landschap. Je kent hem wellicht van artikelen in Java Magazine (o.a. 'Scala voor Java ontwikkelaars' en 'Hibernate Performance & Tuning') of eerdere presentaties op J-Fall en soortgelijke conferenties.

PDF: slides.pdf

Slides:

Demo



Demo



ForkJoin & Java EE



Comparison



Comparison



Criticism



Future



Future



Future



Questions?


Questions? Code @ bit.ly/bejug-akka

Akka Actors


Akka Actors @Sander_Mak

Akka


Akka Part of stack Written in Scala With officially supported Java API

Akka


Akka `s premise It's too hard to write systems that are: Concurrent & Correct Highly scalable Fault-tolerant

Akka


Akka 2.0 Actors Software Transactional Memory Dataflow concurrency Futures

Akka


Akka who uses ? traffic management

Actors


Actors Inspired by : Asynchronous message passing Scale up, scale out Fault-tolerant (`let it crash')

Actors


Actors How to define an actor? ~400 bytes Local state Behavior mailbox

Actors


Actors How to define an actor? Create more actors Send messages Modify state Modify behavior Local state Behavior ~400 bytes mailbox

Actors


Actors How to define an actor? class MyFirstActor extends Actor { var total = 0 def receive = { case MyMessage(payload) => println("Received: " + payload") case countMessage: Int => total += countMessage case _ => println("Unknown message") } }

Akka Scala Demo



Actors


Actors Dispatcher: contains executor strategy Local state Event-driven Behavior mailbox

Actors and Fork/Join


Actors and Fork/Join Ping/pong messages (no processing) 48 cores Improved JSR-166 build ( ?)

Demo


Demo NearestCityActor NearestCityActor NearestCityActor NearestCityActor RoundRobin Router Result ListenerActor Messages with cities Print results

Akka Demo



Questions?


Questions? Code @ bit.ly/bejug-akka