Akka中的Dispatcher和Routers之间的区别 [英] difference between Dispatcher and Routers in Akka

查看:83
本文介绍了Akka中的Dispatcher和Routers之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在浏览Akka文档&其他维基。谁能告诉我Dispatcher& and之间的区别是什么? Akka框架中的路由器?

I am going through akka documentation & other wiki's. Can anyone tell me what is the difference between Dispatcher & Routers in Akka framework?

推荐答案

Dispatcher 路由器是Actor系统的两个不同概念。调度程序基本上是一个线程池,这意味着可以使用调度程序执行任意代码,当然,您可以自定义线程池的配置(在fork-join池和线程执行程序之间进行选择,设置最大/最小并行度,请检查默认的 dispatcher conf reference.conf )。虽然路由器一词与部署过程有关,并且指定了将消息路由到路由列表的路由逻辑,但是您可以在其中为池/组选择合适的策略(例如RoundRobin,Broadcast等),指定路由器路径(对于

Dispatcher and Routers are two different concepts of Actor System. A dispatcher is basically a thread-pool, which means that dispatchers can be used to execute arbitrary code, of course, you can customize a configuration of thread pool (select between fork-join pool and thread executor, set up max/min parallelism level, check default dispatcher conf reference.conf ). While term "Routers" is related to deployment process and specifying routing logic to route messages to a list of routees, where you can select a suitable strategy for pool/group (like RoundRobin, Broadcast, etc.), specify router paths (for a group).

来自规范:


路由:消息可以通过以下方式发送:路由器有效地将
路由到目的地演员,称为路由。

Routing: Messages can be sent via a router to efficiently route them to destination actors, known as its routees.

Dispatcher是Akka Actors的代号,是引擎的引擎可以这么说,
机器可以用来执行任意代码,例如
实例期货

Dispatcher is what makes Akka Actors "tick", it is the engine of the machine so to speak, they can be used to execute arbitrary code, for instance Futures

可以看到,它们都对Actor系统的绝对不同部分负责,但是您可以将它们两者组合在一起以定制相同的actor系统配置。有关更多详细信息,请参见文章。 HTH

As you see, both of them are responsible for an absolutely different part of Actor System, but you can combine both of them for customization of the same actor system configuration. For more details, check this article. HTH

这篇关于Akka中的Dispatcher和Routers之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆