scala 构建基于 Actor 的系统的设计模式/最佳实践
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3931994/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Design patterns/best practice for building Actor-based system
提问by Vasil Remeniuk
I am struggling to find any decent links to design patterns, best practice or good, basic architectural principles that should be used in building Actor-based apps. Those few that I know of are:
我正在努力寻找设计模式、最佳实践或良好的基本架构原则的任何体面链接,这些链接应该用于构建基于 Actor 的应用程序。我所知道的几个是:
Blog posts, articles, WIKIs, guides
博客文章、文章、WIKI、指南
- OTP Design Principles User's Guide
- Patterns and Best Practices for Enterprise Integration(in general, can be applied to any message-driven architecture)
- Series of posts by James Iry on dealing with state in design with actors
- Series of posts on design with Scala actorsby Ittay Dror
- Concurrency patternsarticle on wikipedia
- Scalable System Design Patterns(not directly related to actors, but quite useful)
- Understanding actor concurrency, pt.1, pt.2by Alex Miller
- OTP 设计原则用户指南
- 企业集成的模式和最佳实践(一般来说,可以应用于任何消息驱动的架构)
- James Iry 撰写的关于与演员一起处理设计中的状态的系列文章
- Ittay Dror与 Scala 演员一起设计的系列文章
- 维基百科上的并发模式文章
- 可扩展的系统设计模式(与参与者没有直接关系,但非常有用)
- 理解 actor 并发性,第 1部分,第 2 部分作者:Alex Miller
Papers
文件
- Disseration on making reliable distributed systemsby Joe Armstrong
- Scalabale Component Abstractionsby Philipp Haller and Martin Odersky
- Event-based programming without inversion of controlby Martin Odersky and Matthias Zenger
- Actors with Multi-Headed Message Receive Patternsby Martin Sulzmann
- Joe Armstrong关于制作可靠分布式系统的论文
- Philipp Haller 和 Martin Odersky 的Scalabale Component Abstractions
- Martin Odersky 和 Matthias Zenger 的无控制反转的基于事件的编程
- 具有多头消息接收模式的Actorsby Martin Sulzmann
Books
图书
- Actors In Scalaby Philipp Haller and Frank Sommers
- Programming Erlangby Joe Armstrong
- Erlang and OTP in Actionby Martin Logan, Eric Merritt, and Richard Carlsson
- 菲利普·哈勒 (Philipp Haller) 和弗兰克·萨默斯 (Frank Sommers) 的《斯卡拉的演员》
- 乔·阿姆斯特朗 (Joe Armstrong) 的Erlang 编程
- Erlang 和 OTP in Action作者:Martin Logan、Eric Merritt 和 Richard Carlsson
Implementations
实现
- Akka Framework(alternative implementation of actors in Scala with a port of several Erlang behaviors and lots of other relized patterns for actors)
- Scalaz Actors(actor compositions, strategies and promises)
- Akka 框架(Scala 中演员的替代实现,带有几个 Erlang 行为的端口和许多其他演员的相关模式)
- Scalaz Actors(演员作品、策略和承诺)
Presentations
演示文稿
- Actor Thinkingby Dale Schumacher
- 1000 Year-old Design Patternsby Ulf Wiger
- Actor-based Programmingby Jamie Ridgway
- Школа Актерского Мастерстваby Vasil Remeniuk
- 戴尔舒马赫的演员思考
- Ulf Wiger 的1000 年设计模式
- Jamie Ridgway的基于演员的编程
- Школа Актерского Мастерстваby Vasil Remeniuk
Examples from highscalability.com
来自 highscalability.com 的示例
- Simple queuing service (SQS)- this service provides an internet scale queuing service for storing messages. Distributed actors put work on the queue and take work off the queue. Typical use: a centralized work queue. You put jobs on the queue and different actors can pop work of the queue and process them when they get CPU time. Part of scalability. Have any number of producers and consumers. You don't worry about it. Queues are spread across multiple machines and multiple data centers.
- 简单排队服务 (SQS)- 此服务提供用于存储消息的 Internet 规模排队服务。分布式参与者将工作放入队列并从队列中取出工作。典型用途:集中式工作队列。您将作业放在队列中,不同的参与者可以弹出队列中的工作并在获得 CPU 时间时处理它们。可扩展性的一部分。有任意数量的生产者和消费者。你不用担心。队列分布在多台机器和多个数据中心。
采纳答案by oxbow_lakes
This is related to a previous question, if not exactlythe same!
这与之前的问题有关,如果不完全相同!
It's not such a simple question because the actor modelof concurrency allows for many different types of applications to be built, from a stateful single-VM application (with a few separate actor classes) to a stateless cluster of thousands of instances of an actor class.
这不是一个简单的问题,因为并发的actor模型允许构建许多不同类型的应用程序,从有状态的单VM应用程序(具有几个单独的actor类)到一个actor类的数千个实例的无状态集群.
The core principles are the same however:
然而,核心原则是相同的:
- Never expose an actor's state
- Communicate solely via the passing of immutable messages
- 永远不要暴露演员的状态
- 仅通过传递不可变消息进行通信
回答by jamie
I posted a blog on learnings of actor developmentin Scala a few weeks ago. It's a post of a best practices and things to avoid based on a few years of experience with the paradigm.
几周前,我发布了一篇关于在 Scala 中学习演员开发的博客。这是一篇基于几年范式经验的最佳实践和要避免的事情的帖子。
回答by botkop
The book 'Reactive Design Patterns' is in the making at Manning.
Manning 正在编写“Reactive Design Patterns”一书。

