如何在 WSO2 ESB 中设置线程池 (Dsnd_t_max) [英] How to set ThreadPool (Dsnd_t_max) in WSO2 ESB

查看:23
本文介绍了如何在 WSO2 ESB 中设置线程池 (Dsnd_t_max)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

WSO2 ESB 未加载所有代理(超过 20 个).然后我们在启动脚本中增加了以下两个值,它起作用了:

WSO2 ESB is not loading all proxies (more than 20). Then we increased following two values in the startup script and it worked:

-Dsnd_t_core=120
-Dsnd_t_max=600

但后来我们遇到了 WSO2 ESB 的几个致命问题.几个 JMS 代理被阻止并且不再使用消息.最糟糕的是:carbon.log 中没有错误!

But then we encountered several fatal issues of the WSO2 ESB. Several JMS proxies were blocked and did not consume anymore messages. The worst thing of all: NO ERROR in the carbon.log!

此外,服务器上的 CPU 负载上升到 100%.

In addition the CPU load on the server went up to 100%.

重启并没有解决问题,只有停用计划任务或代理才能解决问题.

A restart did not solve the problem, only deactivating scheduled tasks or proxies solved the problem.

我们现在发现,VFS 代理正好创建了 120 个线程 (JConsole).每次 transport.PollInterval 都会创建一个新线程.

We now discovered, that a VFS proxy is creating exactly 120 threads (JConsole). With each transport.PollInterval it creates a new Thread.

您对 -Dsnd_t_core 和 max 使用哪个值?

为什么 VFS 代理会在每个 PollInterval 期间创建一个新线程(请参阅 jconsole)?

推荐答案

据我所知,WSO2 ESB 线程是基于 java.util.concurrent ThreadPool 的.

As long as I know, WSO2 ESB thread is based on java.util.concurrent ThreadPool.

在这个链接中,您可以阅读一些 ThreadPool 特性,例如它何时创建新线程、队列机制和拒绝任务策略.

In this link you can read about some ThreadPool characteristics like when will it create a new thread, the queue mechanism, and reject task policy.

您对 -Dsnd_t_core 和 max 使用哪个值?
-Dsnd_t_core 是 ThreadPool 内的最小线程数.因此,WSO2 ESB 将根据您设置的 -Dsnd_t_core 自动创建线程.默认值为 20.如果您不指定 -Dsnd_t_core,WSO2 ESB 将创建 20 个 vfs-worker.
-Dsnd_t_max 是 ThreadPool 内的最大线程数.如果达到最大数量,WSO2 ESB 将停止创建新线程.

Which values do you use for the -Dsnd_t_core and max?
-Dsnd_t_core is the minimum number of threads inside a ThreadPool. So WSO2 ESB will automatically create thread as much as you set the -Dsnd_t_core. The default value is 20. WSO2 ESB will create 20 vfs-worker if you don't specify the -Dsnd_t_core.
-Dsnd_t_max is the maximum number of threads inside a ThreadPool. WSO2 ESB will stop create a new thread if the maximum number is reached.

为什么 VFS 代理会在每个 PollInterval 期间创建一个新线程(请参阅 jconsole)?
WSO2 ESB 将在这些条件下创建一个新线程:

Why is a VFS proxy creating a new thread (see jconsole) a t each PollInterval?
WSO2 ESB will create a new thread in these conditions :

  • 如果运行的线程数少于 corePoolSize,Executor 总是倾向于添加新线程而不是排队.
  • 如果 corePoolSize 或更多线程正在运行,Executor 总是倾向于将请求排队而不是添加新线程.
  • 如果一个请求不能排队,就会创建一个新线程,除非这会超过maximumPoolSize,在这种情况下,任务将被被拒绝了.

因此,只要您的队列已满且未达到最大线程数,WSO2 就会创建一个新线程来处理进程.PollInterval 设置为指定服务开始轮询源文件夹中的消息或文件之前的延迟.

您可以将 maxQueue 编号设置为未绑定 (-1),这样队列就永远不会满,也永远不会创建新线程.

我还从 JConsole 中找到了一些东西.1 个服务/1 个代理服务将仅由 1 个线程处理.我仍然试图弄清楚这一点,并使 1 个服务/1 个代理服务由 2 个或更多线程(多线程)处理.

希望这将有助于回答您的问题:)

So, as long as your queue is full and the maximum number of threads is not reached, WSO2 will create a new thread to handle a process. The PollInterval is set to specify the delay before your service start to poll the message or file from the source folder.

You can set the maxQueue number to unbound (-1) so the queue will never full and new thread will never be created.

I also found something from the JConsole. 1 service/1 proxy service will be handled only by 1 thread. I still trying to figure this out and make 1 service/1 proxy service is handled by 2 or more thread (multithread).

Hope this will help answer your question :)

这篇关于如何在 WSO2 ESB 中设置线程池 (Dsnd_t_max)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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