Blog

May 12, 2011

Why Akka?

May 12, 2011

by Jonas Bonér

Twenty years ago, when people needed to solve a software scalability problem, the solution was almost always to “scale up” by purchasing an expensive multiprocessor server from Sun or IBM. Then, as commodity hardware grew cheaper and more powerful, the trend shifted towards “scaling out” by using clusters of less expensive servers. Today, with the arrival of commodity multicore CPUs and cloud computing, we face the dual challenge of scaling “up and out” at the same time.

I've been writing middleware systems for most of my career, through the transitions from “scale up” to “scale out” and back again, applying concurrency and distributed computing to solve scalability problems. Along the way, I've always felt that there must be a fundamentally better way to build scalable software. Finally, about three years ago, I decided to do something about it. 

I created the Akka project with the vision of a runtime and programming model that would address the challenges of both multicore and distributed computing. Akka gives developers a unified way to build scalable and fault-tolerant software that can scale up on multicore systems, and scale out in distributed computing environments, which today often means in the cloud. Akka makes it possible to build software systems with reliability and high performance, without sacrificing developer joy and productivity.

In short, Akka is open source middleware for building highly concurrent, distributed and fault-tolerant systems on the JVM. Akka is built with Scala, but offers both Scala and Java APIs to developers.

At the heart of Akka is the concept of Actors, which provide an ideal model for thinking about highly concurrent and scalable systems. Writing concurrent systems using traditional low-level mechanism such as locks and threads is difficult. The resulting software is often hard to understand and maintain. The Actor model provides a higher-level alternative that is much easier to reason about. Actors also provide location transparency, in the sense that the user of an Actor does not need to know whether that Actor lives in the same process or on a different machine. This makes it simple to write software that can scale with the needs of the application. It also gives the runtime the freedom to provide services like adaptive load balancing, cluster rebalancing, replication and partitioning.

Importantly, Akka embraces Erlang’s model for fault-tolerance, colloquially known as “let it crash.” This fault tolerance model works by organizing the various Actors in a system in a supervisor hierarchy such that each component is monitored by another, and restarted upon failure. The model has been used to great effect in the telecommunications equipment industry for years, as the foundation of highly available systems that can adaptively heal themselves while running.

The Actor model alone, while great for many use cases, do not solve all concurrency and scalability problems. By decomposing state into many discrete Actors, the model can introduce challenges for applications that require global consistency. To address this problem, Akka uses Software Transactional Memory (STM), which makes it possible to modify the state of many objects at once, reverting all changes if the transaction fails. In addition to STM, Akka provides several other concurrency abstractions such as Agents and Dataflow Concurrency.

Since the introduction of Akka, the project has attracted a tremendous community of users and contributors. In the past year, Akka has matured with a rich and cohesive set of modules that can be composed to solve a wide variety of business requirements. Now, as part of the Typesafe Stack, we intend to take Akka to the next level with enterprise grade features and supporting commercial services.

We have big plans for Akka. This is just the beginning. And we look forward to partnering with the rest of the team at Typesafe to write the next chapter in software development.

comments powered by Disqus
Browse Recent Blog Posts