InfoQ talked to Jonas Bonér about the intent behind Akka, its current state and adoption, and future plans. His answers start the different sections covered here.

A Scalable Solution to the Concurrency Challenge

Q: What kind of problems does Akka address?

In my experience writing correct concurrent, scalable and fault-tolerant applications is too hard. Most of the time it's because we are using the wrong tools and the wrong level of abstraction. Akka is an attempt to change that, to simplify writing concurrent, scalable and highly available software for the JVM.

Q: Can you please tell us a bit about Akka's components and architecture?

Akka is using the Actor Model together with Software Transactional Memory (STM) to raise the abstraction level and provides a better platform to build correct concurrent and scalable applications. For fault-tolerance it adopts the "Let it crash" model which have been used with great success in the telecom industry to build applications that self-heals, systems that never stop. Akka also has Remote Actors and cluster support which provide for transparent distribution and the basis for truly scalable and fault-tolerant applications.

Akka's approach is a reimplementation of the actors paradigm that was initially presented by Carl Hewitt in 1973, and which has been sucessfully employed in languages like Erlang and in the telco industry where highly scalable systems with very high availability are common.

The actors approach is based solely on sending one-way (fire & forget), immutablemessages to other actors and not sharing state at all. As actors don't have to be represented by threads and are very lightweight (about 600 bytes per actor) several million actors can be running on a commodity machine.

Error handling within the actors does not scale and is also not able to address the bigger picture. Thats why actors are supposed to die in the cause of failure and supervising actors are responsible for the fault handling of a group of actors linked to them. They are able to restart the failed actor or the whole group.

APIs and Usage

Q: How could I as a developer use Akka for my purposes?

You can use Akka for many different things and in many different ways. Deployment-wise you can for example use it as a library JAR and put it in WEB_INF/lib in your regular web application. Or you can run it as a stand-alone microkernel with one or many of its add-on modules (REST, Comet, Servlets, Persistence etc.).

Currently there is straightforward Scala API for creating actors, sending and receiving messages. Scala's case classes can be idiomatically applied as message types, so that immutability is guaranteed and pattern matching easily possible.

Actors can have different lifecycle methods. For supervision purposes linking actors, declaring Throwables that are acted upon and providing fault handlers with different restart strategies is supported.

Java Integration

Integration with Java is supplied by an "Active Objects" approach. It uses AOP through AspectWerkz to turn regular POJOs into asynchronous non-blocking Active Objects with semantics of the Actor Model:

MyPOJO pojo = ActiveObject.newInstance(MyPOJO.class, 1000);

Non-void Methods are turned into "send-and-receive-eventually" semantics by asynchronously sending the message and wait on the reply using a Future. The immutability of the parameters has to be guaranteed by the sender as otherwise the actor model's semantics are broken. There is a configuration which deep clones all parameters that are neither primitives nor annotated as immutable.

Integration Modules

Q: How does Akka integrate with other infrastructures, libraries and tools?

Akka has excellent AMQP integration, JAX-RS integration for RESTful actors and Comet integration but in my view the most powerful and useful integration is the new Apache Camel integration that Martin Krasser has build. It allows Akka to integrate seamlessly and with almost no code with everything that Apache Camel supports.

Current release and development

Q: What are you planning for the future of this project?

In the short term we will support Scala 2.8, richer API for cluster membership and OSGi support. Long term we will have a distributed STM, JTA/XA support, more persistence back-ends (currently only Cassandra, Redis and MongoDB). We are currently in the process of starting up a business around Akka and will shortly be able to provide different levels of support packages and commercial add-on features such as management/monitoring and provisioning.

After the 0.6 release in January, this 0.7 release brings some very interesting features:

Apache Camel integration

Server-managed Remote Actors

!!! function that returns a Future

Clojure-style Agents

Shoal cluster backend

Redis-based transactional queue storage backend

Distributed Comet

Spring integration

Q: What kind of feedback have you gotten so far, who's using Akka right now?

We've seen a wide range of use-cases where Akka has been useful. There are companies in various domains such as gaming, betting, social networking, data mining/expert systems and finance that either have or will shortly deploy Akka in production. It's exciting times.

Thanks to Jonas for providing the Akka framework and for answering the questions

1) What would be wrong with an erlang for Java? Erlang has very nice concepts but it doesn't run on a JVM (yet.. Erjang is being created)2) Akka supports much more than just actors to deal with concurrency. It also is possible to let actors access shared state using STM. Afaik Erlang has no support for STM. 3) There is a lot of integration with all kinds of technologies going on in the Akka project.