本文介绍了Spring批量corePoolSize VS节流限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道 corePoolSize 限制限制之间的区别,因为Spring Batch属性定义了多线程配置。

I'd like to know the difference between corePoolSize and throttle-limit as Spring Batch attributes defining multi threading configuration.

由于这篇文章

但我的问题涉及 corePoolSize vs 限制限制 ......我找到了最好定义CorePoolSize = Throttle-limit,但我想知道......如果我定义例如:
CorePoolSize = 100和Throttle-limit = 200 ......会发生什么?是否会创建200个大小的线程池或100个?

But my issue concerns corePoolSize vs throttle-limit... I found that it's preferable to define CorePoolSize = Throttle-limit, but I'm wondering... if I define for example :CorePoolSize = 100 and Throttle-limit = 200... What happens ? Is a 200 sized thread pool that will be created or 100 ?

感谢您的任何澄清......

Thank you for any clarification...

推荐答案

核心池大小表示线程池执行程序将以 N 线程数开头。限制 T 表示,无论线程池中可用的线程数是多少,只使用 T 用于tasklet的那些线程。

The core pool size says a thread pool executor will start with N number of threads. A throttle-limit T says that, regardless of the number of threads available in the thread pool, only use T of those threads for a tasklet.

因此,您可以拥有一个核心池大小为8的线程池和两个限制为4的tasklet,在这种情况下,您将使用您的线程池。但是如果你只有一个限制为4的tasklet你将使用一半的线程池。

So you can have a thread pool with a core pool size of 8 and two tasklets with throttle limit of 4 in that case you will be utilizing your thread pool. But if you only have one tasklet with a throttle limit of 4 you will be utilizing one half of the thread pool.

这篇关于Spring批量corePoolSize VS节流限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-13 14:35