Sunday, April 29, 2012

SVWJUG: Actors in AKKA

I went to a talk titled "Composable Futures With Akka 2.0" at the Silicon Valley Web Java Users Group at the famed Googleplex.  It was by Mike Slinn who has this new book with the same title.  Akka is a concurrency library for Scala and Java.

To AVOID the code-equivalent of this
race-condition, use Akka Futures.
One of the more interesting features of futures is that if you take quotes out of context, they can be hilarious:
"[You can] attempt to change the future, you will fail." --Mike Slinn, apparent determinist

It was a highly technical talk revolving around concurrency, everything that can go (easily) wrong and how to make sure that it goes right.  Mike was a great guy and posted his slides as well.

The tl;dr: Futures will let you have deterministic multi-threading.  If you can't tell, this is a big deal in that you can be confidant that your unit tests will mean that the app works correctly in production (no tricky race conditions!)  However, futures don't scale to multiple mother-boards so it isn't a grid-computing solution.  Futures are also composable and immutable (see quote above).

Concurrency is going to be increasingly important as the clock speed of silicon has basically been maxed out and Moore's Law is only continuing due to more cores, so if you want your program to run faster in the future than it does today you'll need to use concurrency.  If you're going to use concurrency, make it as predictable and repeatable as possible (e.g. eliminate race conditions).  Akka Futures let you do this.

Update: Mike Slinn also has a related article on InfoQ.

2 comments:

  1. Here is another quote for you: "The future will be exactly like the present, only more expensive."
    - Mike

    ReplyDelete