Object Capabilities and Uniqueness for Isolating Actors in Akka

University essay from KTH/Skolan för elektroteknik och datavetenskap (EECS)

Author: Fredrik Sommar; [2018]

Keywords: ;

Abstract: Large-scale concurrent systems need to ensure that the number of bugs is as low as possible, especially since the symptoms may appear far from the cause. Data races, for instance, is caused by the lack of isolation between systems. Akka is the de facto actor library, which is a common way to write large-scale concurrent systems, and is written for the statically typed language Scala. LaCasa is a compiler plugin for Scala that introduces object capabilities and uniqueness to Scala’s type system, providing isolation and thus preventing data races. This thesis investigates compile-time isolation for actors by designing and implementing an adapter for LaCasa in Akka. The adapter was developed as a set of alternative versions of Akka interfaces created in a similar package hierarchy, each wrapping their Akka equivalent. That way, the concepts from Akka carry over, while a new, safer, API is exposed. Users can either ensure all their messages are Safe, which is a marker that signifies deeply immutable classes, since deeply immutable objects have isolation properties by default, or resort to using boxes – LaCasa’s core concept, providing object capabilities and uniqueness to isolate references. The adapter supports receiving both Safe messages and boxes from the same actor, where Safe messages are treated similarly to how regular Akka handles messages. To evaluate the adapter, a selection of programs was picked from the Savina actor benchmark suite, capturing different kinds of actor applications. The results show that it is feasible to use the adapter for existing applications – when all messages are Safe, which was true for 6 out of 7 applications. It exceeds expectations set in the hypothesis; requiring on average 10% of code to be modified for Safe messages, and with an insignificant change in total lines of code. Furthermore, the performance impact was also shown to be insignificant with the introduction of LaCasa. During the migration, several patterns were observed and documented in Chapter 6. Future work should be put into supporting more Akka patterns, automate the marking of Safe types and increase the conveniencewhen using boxes.

  AT THIS PAGE YOU CAN DOWNLOAD THE WHOLE ESSAY. (follow the link to the next page)