Akka v2.5.0-RC1 发布,Actor 模型开发库

摘要:Akka 是一个用 Scala 编写的库,用于简化编写容错的、高可伸缩性的 Java 和 Scala 的 Actor 模型应用。


Akka 是一个用 Scala 编写的库,用于简化编写容错的、高可伸缩性的 Java 和 Scala 的 Actor 模型应用。它已经成功运用在电信行业。系统几乎不会宕机(高可用性 99.9999999 % 一年只有 31 ms 宕机)。

Actor模型并非什么新鲜事物,它由Carl Hewitt于上世纪70年代早期提出,目的是为了解决分布式编程中一系列的编程问题。其特点如下:

  • 系统中的所有事物都可以扮演一个Actor
  • Actor之间完全独立
  • 在收到消息时Actor所采取的所有动作都是并行的,在一个方法中的动作没有明确的顺序
  • Actor由标识和当前行为描述
  • Actor可能被分成原始(primitive)和非原始(non primitive)类别
  • 非原始Actor有
    • 由一个邮件地址表示的标识
    • 当前行为由一组知识(acquaintances)(实例变量或本地状态)和定义Actor在收到消息时将采取的动作组成
  • 消息传递是非阻塞和异步的,其机制是邮件队列(mail-queue)
  • 所有消息发送都是并行的


  • The Java API for AbstractActor was promoted to fully stable API. While doing this we made some small, yet important, improvements to the API that will require some mechanical changes of your source code.Thanks to@ortigali for help.
  • Faster and more flexible Akka Streams materializer, which matters for short lived streams, such as HTTP requests.
  • Distributed Data was promoted to a fully stable module. Several improvements were also included, such as:
    • Support for delta-CRDTs in Distributed Data to reduce the amount of data that is replicated, thanks to help from @gosubpl.
    • Generic type for the key in Distributed Data ORMap, thanks to @jgordijn
  • Coordinated shutdown to facilitate ordered stopping of actors and services and perform registered tasks during the shutdown process. This greatly simplifies tasks involved in graceful leaving of Akka Cluster.
  • Support remembering entities in Cluster Sharding with the Distributed Data (ddata) mode. ddata is now also the default mode for Cluster Sharding.
  • New Java API for Testkit taking advantage of lambas, thanks to @Hawstein
  • Fix performance regression for Scala 2.12, due to change in scheduling fairness of the JDK8 ForkJoinPool implementation
  • We added @ApiMayChange and other annotations which can be used to mark experimental API inside stable modules, primarily for use in Akka HTTP. API improvements of Akka Typed, including Java API