Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 22.7.7 #4545

Merged
merged 8 commits into from
Oct 19, 2022
Prev Previous commit
Next Next commit
Tune EthScheduler thread pools to avoid to recreate too many threads (#…
…4529)

Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
  • Loading branch information
fab-10 committed Oct 19, 2022
commit b46ebcf2f0c7a31e4610334b74662d0e13ab7adf
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,12 @@ public EthScheduler(
final MetricsSystem metricsSystem) {
this(
MonitoredExecutors.newFixedThreadPool(
EthScheduler.class.getSimpleName() + "-Workers", syncWorkerCount, metricsSystem),
EthScheduler.class.getSimpleName() + "-Workers", 1, syncWorkerCount, metricsSystem),
MonitoredExecutors.newScheduledThreadPool(
EthScheduler.class.getSimpleName() + "-Timer", 1, metricsSystem),
MonitoredExecutors.newBoundedThreadPool(
EthScheduler.class.getSimpleName() + "-Transactions",
1,
txWorkerCount,
txWorkerQueueSize,
metricsSystem),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,20 @@
public class MonitoredExecutors {

public static ExecutorService newFixedThreadPool(
final String name, final int workerCount, final MetricsSystem metricsSystem) {
return newFixedThreadPool(name, 0, workerCount, new LinkedBlockingQueue<>(), metricsSystem);
final String name,
final int minWorkerCount,
final int workerCount,
final MetricsSystem metricsSystem) {
return newFixedThreadPool(
name, minWorkerCount, workerCount, new LinkedBlockingQueue<>(), metricsSystem);
}

public static ExecutorService newBoundedThreadPool(
final String name,
final int workerCount,
final int queueSize,
final MetricsSystem metricsSystem) {
return newBoundedThreadPool(name, 0, workerCount, queueSize, metricsSystem);
return newBoundedThreadPool(name, 1, workerCount, queueSize, metricsSystem);
}

public static ExecutorService newBoundedThreadPool(
Expand Down Expand Up @@ -77,8 +81,8 @@ private static ExecutorService newFixedThreadPool(
new ThreadPoolExecutor(
minWorkerCount,
maxWorkerCount,
0L,
TimeUnit.MILLISECONDS,
60L,
TimeUnit.SECONDS,
workingQueue,
threadFactory,
rejectedExecutionHandler));
Expand Down