基于Agent/Actor的并发设计模式[英] Design patterns for Agent / Actor based concurrent design

本文是小编为大家收集整理的关于基于Agent/Actor的并发设计模式的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。

问题描述

最近,我进入了支持演员/代理/共享架构的替代语言 - 即. Scala,Clojure等(Clojure也支持共享状态).

到目前为止,我已经阅读的大部分文档都关注介绍级别.我正在寻找的是沿着四个团伙的更高级文档,而是什么也没有共享.

为什么?它有助于理解设计思维的变化.简单的示例很容易,但是在现实世界中的Java应用程序(单线线)中,您可以拥有具有1000个成员具有复杂关系的对象图.但是,借助基于代理的并发发展,它引入了一系列全新的想法,可以在设计大型系统时理解. IE.代理粒度 - 一个代理应该管理多少状态 - 对性能等的影响,或者是将共享状态对象图映射到基于代理的系统的良好模式.映射域模型的技巧.讨论不是关于技术的讨论,而是关于如何最好地在设计中使用该技术的更多内容(现实世界"复杂"的示例将是很棒的).

推荐答案

即使我无法提出任何为您提供设计的好现实世界示例 图案直接上升,有一些起点.

首先,将您的头缠绕在概念上.一本书帮助 您要这样做是在存在软件错误的情况下制作可靠的分布式系统 由Erlang Guru Joe Armstrong撰写 以非常易于访问的方式.实际上是博士学位.论文,但不要让那吓到你. 与大多数常见的教科书相比,它更容易阅读和讨价还价.

查看实际系统通常意味着您必须了解太多的实际系统 语言也只是为了评估事物而有意义.对于 documentation 提供设计方法和行为(设计模式库的Erlang Speek). 这将说明此设置中最常用的设计模式.还有这些 事实证明,在构建大规模系统中有效,即数百万行的代码(与Java等其他语言相当)和在分布式机器中运行的一台机器上运行的并发过程的Milloins. 真实实时系统的最新示例是 facebook chat .

对于其他框架,我真的无法帮助您.

其他推荐答案

"演员"本身就是并发编程的统一模式(异步消息队列以及处理它的执行上下文),但是有许多设计模式有助于指定基于代理系统的方面或元素.在Wikipedia的文章中可以找到许多最常见的信息,上面写着 concrency模式.一些亮点:

如果您尚未遇到它, akka 可能对您很感兴趣 - 这是一个在JVM上运行的"纯"事件驱动的演员框架.

其他推荐答案

我问了一个类似的问题在这里有一些合理的答案可能会有所帮助.我仔细看着你的.我还没有找到真正帮助我的东西,但是我非常积极地寻找.

我认为,思维转移是踏入并发的架构和语言的最大障碍,直到那是破裂的开发人员将坚持使用易于学习的MS样式范式.为了使它真正成为主流,需要找到进入学校的路,并与C#和VB一起教授.

我对 2080程序员问题是"同时".

本文地址:https://www.itbaoku.cn/post/627374.html

问题描述

Recently i have been getting into alternative languages that support an actor/agent/shared nothing architecture - ie. scala, clojure etc (clojure also supports shared state).

So far most of the documentation that I have read focus around the intro level. What I am looking for is more advanced documentation along the gang of four but instead shared nothing based.

Why ? It helps to grok the change in design thinking. Simple examples are easy, but in a real world java application (single threaded) you can have object graphs with 1000's of members with complex relationships. But with agent based concurrency development it introduces a whole new set of ideas to comprehend when designing large systems. ie. Agent granularity - how much state should one agent manage - implications on performance etc or are their good patterns for mapping shared state object graphs to agent based system. tips on mapping domain models to design. Discussions not on the technology but more on how to BEST use the technology in design (real world "complex" examples would be great).

推荐答案

Even if I cannot come up with any good real world examples that provide you with design patterns straight up, there are a few places to start.

The first is getting your head wrapped properly round the concepts. One book helping you do this is Making reliable distributed systems in the presence of software errors written by an Erlang Guru Joe Armstrong where explains Concurrency Oriented Programming in a very accessible way. It is in fact a Ph.D. thesis, but do not let that scare you. It is by far easier to read, and pleasant into the bargain, than most common text books.

Looking at actual systems normally means that you have to learn too much about the actual language for it too make sense just to evaluate things. For Erlang the documentation provides design methodology and behaviours(Erlang speek for design pattern libraries). This will illustrate the design patterns most commonly used in this setting. And these have proved to be effective in building large scale systems, i.e. millions of lines of code (comparable to a factor 4 to 10 of other languages such as Java) and milloins of concurrent processes running on one machine in distributed clusters of machines. A recent example of a real live system is Facebook Chat.

For the other frameworks I cannot really help you I am afraid.

其他推荐答案

An "actor" is itself the unifying pattern for concurrent programming (an asynchronous message queue plus an execution context for processing it), but there are many design patterns which assist in specifying aspects or elements of agent-based systems. Many of the most common can be found in Wikipedia's article on Concurrency Patterns. Some highlights:

If you haven't come across it already, Akka may be of interest to you -- it is a "purely" event-driven actor framework running on the JVM.

其他推荐答案

I asked a similar question here which had some reasonable answers that may help. I'm watching yours carefully. I haven't yet found something which has really helped me, but I am very actively looking.

I think the mind-shift is the single largest barrier to stepping to concurrent architectures and languages and until that is cracked developers are going to stick with easy to learn MS style paradigms. For it to really become mainstream it needs to find its way into schools and be taught alongside C# and VB.

My answer to the 2080 programmers question is "concurrently".