mirror of
https://github.com/corda/corda.git
synced 2025-02-12 05:35:50 +00:00
[ENT-2135]: Reigning in the over-ambitious flow framework default thread pool size (#1075)
This commit is contained in:
parent
a70ed52e87
commit
ab37686ba0
@ -300,7 +300,7 @@ absolute path to the node's base directory.
|
||||
Corda Enterprise allows the node operators to configure the number of threads the state machine manager can use to execute flows in
|
||||
parallel, allowing more than one flow to be active and/or use resources at the same time.
|
||||
|
||||
The default value is 4 times the number of cores available which was found to be working efficiently in
|
||||
The default value is 2 times the number of cores available which was found to be working efficiently in
|
||||
performance testing.
|
||||
The ideal value for this parameter depends on a number of factors.
|
||||
The main ones are the hardware the node is running on, the performance profile of the
|
||||
@ -308,7 +308,7 @@ absolute path to the node's base directory.
|
||||
so for n threads, the database system must have at least n+1 connections available. Also, the database
|
||||
must be able to actually cope with the level of parallelism to make the number of threads worthwhile - if
|
||||
using e.g. H2, any number beyond 8 does not add any substantial benefit due to limitations with its internal
|
||||
architecture.
|
||||
architecture. For these reasons, the default size for the flow framework thread pool is the minimum between two times the available number of processors and 30. Overriding this value in the configuration allows to specify any number.
|
||||
|
||||
:rpcThreadPoolSize: The number of threads handling RPC calls - this defines how many RPC requests can be handled
|
||||
in parallel without queueing. The default value is set to the number of available processor cores.
|
||||
|
@ -27,12 +27,16 @@ import net.corda.nodeapi.internal.crypto.loadKeyStore
|
||||
import net.corda.nodeapi.internal.crypto.save
|
||||
import org.slf4j.LoggerFactory
|
||||
import java.nio.file.Path
|
||||
import kotlin.math.min
|
||||
|
||||
fun configOf(vararg pairs: Pair<String, Any?>): Config = ConfigFactory.parseMap(mapOf(*pairs))
|
||||
operator fun Config.plus(overrides: Map<String, Any?>): Config = ConfigFactory.parseMap(overrides).withFallback(this)
|
||||
|
||||
object ConfigHelper {
|
||||
|
||||
// 30 is a temporary max to prevent issues with max server-side allowed database connections, until we switch to proper pooling.
|
||||
private const val FLOW_THREAD_POOL_SIZE_MAX = 30
|
||||
|
||||
const val CORDA_PROPERTY_PREFIX = "corda."
|
||||
|
||||
private val log = LoggerFactory.getLogger(javaClass)
|
||||
@ -51,7 +55,8 @@ object ConfigHelper {
|
||||
|
||||
// Detect the number of cores
|
||||
val coreCount = Runtime.getRuntime().availableProcessors()
|
||||
val multiThreadingConfig = configOf("enterpriseConfiguration.tuning.flowThreadPoolSize" to (coreCount * 4).toString(),
|
||||
val flowThreadPoolSize = min(2 * coreCount, FLOW_THREAD_POOL_SIZE_MAX)
|
||||
val multiThreadingConfig = configOf("enterpriseConfiguration.tuning.flowThreadPoolSize" to flowThreadPoolSize.toString(),
|
||||
"enterpriseConfiguration.tuning.rpcThreadPoolSize" to (coreCount).toString())
|
||||
|
||||
val systemOverrides = systemProperties().cordaEntriesOnly()
|
||||
|
Loading…
x
Reference in New Issue
Block a user