如何配置和调整Akka Dispatchers [英] How to configure and tune Akka Dispatchers

查看:560
本文介绍了如何配置和调整Akka Dispatchers的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在这里查看文档: http://doc.akka。 io / docs / akka / 2.3.3 / java / dispatchers.html

I'm looking over the documentation here: http://doc.akka.io/docs/akka/2.3.3/java/dispatchers.html

我们使用Akka的方式是,我们有两个单独的调度程序(不同参与者的默认fork-join执行者)。现在,我们遇到了一些性能问题,我们正在研究如何调整调度程序配置参数,并查看它们如何影响应用程序的性能。

We're using Akka in such a way where we have two separate dispatchers (default fork-join executors) for different actors. We're now running into some performance issues and we're looking into how we can tune the dispatcher configuration parameters and see how they affect the performance of the application.

I已经查看了文档,但并不太了解配置参数。
例如,仅作为简单的默认值,fork-join-executor调度程序:

I've looked over the documentation but don't really understand the configuration parameters. For example, just for the simple default, fork-join-executor dispatcher:

这些是什么,我们应该如何配置它们以查看它们如何影响应用程序

What are these and how should we configure them to see how they affect application performance?

# Min number of threads to cap factor-based parallelism number to
parallelism-min = 2
# Parallelism (threads) ... ceil(available processors * factor)
parallelism-factor = 2.0
# Max number of threads to cap factor-based parallelism number to
parallelism-max = 10

谢谢!

推荐答案

当然,此配置取决于您的硬件。

This configuration depends on your hardware of course.

假设您的计算机上有2个可用处理器,则可以配置线程数

Say you have 2 available processors on your machine, then you can configure the number of threads that a given dispatcher will have via the parallelism-factor.

current number of thread = available processor * parallelism-factor

然后您可以修复边界以控制分辨率此乘积的最大值,并避免极值。

Then you can fix boundaries to control the result of this multiplication and avoid extreme values.

parallelism-min < current number of thread < parallelism-max

现在,如果您要选择正确的并行度因子和边界,则必须询问您自己,调度员在给定的时间将负责多少演员。

Now if you want to pick the right parallelism-factor + boundaries, you have to ask yourself how many actors at a given time your dispatcher will be responsible for.

合理的假设是,更多的参与者意味着更多的线程,但是我强烈建议您监视系统以发现性能问题的根本原因,而不仅仅是随机调整性能。

It seems logical to assume that more actors means more threads but I strongly encourage you to monitor your system to find the root cause of your performance issues and not just randomly tweaking the configuration.

作为旁注,您应该检查调度程序的吞吐量参数,因为它允许您配置参与者线程分配的公平性。确实可以在类似批处理的过程中产生很大的不同。

As a side note you should check the "throughput" parameter of your dispatcher as it allows you to configure the fairness of the actor's thread allocation. This can really make a big difference in case of batching-like process.

# Throughput defines the maximum number of messages to be
  # processed per actor before the thread jumps to the next actor.
  # Set to 1 for as fair as possible.
  throughput = 100 

这篇关于如何配置和调整Akka Dispatchers的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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