ENT-1953 enterprise tuning config (#1057)

* ENT-1953 enterprise tuning config

* Keep flowThreadPoolSize at 1 for integration tests as some expect certain ordering it seems.

* Log thread count for SMM
This commit is contained in:
Rick Parker 2018-06-22 16:39:17 +01:00 committed by GitHub
parent 84cdf22e5f
commit 2fe5bae8a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 1 deletions

View File

@ -173,6 +173,7 @@ D""".trimStart()
}
private fun makeStateMachineExecutorService(): ExecutorService {
log.info("Multi-threaded state machine manager with ${configuration.enterpriseConfiguration.tuning.flowThreadPoolSize} threads.")
return Executors.newFixedThreadPool(
configuration.enterpriseConfiguration.tuning.flowThreadPoolSize,
ThreadFactoryBuilder().setNameFormat("flow-executor-%d").setThreadFactory(::FastThreadLocalThread).build()
@ -193,6 +194,7 @@ D""".trimStart()
cordappLoader.appClassLoader
)
} else {
log.info("Single-threaded state machine manager with 1 thread.")
return super.makeStateMachineManager(database)
}
}

View File

@ -49,6 +49,11 @@ object ConfigHelper {
val smartDevMode = CordaSystemUtils.isOsMac() || (CordaSystemUtils.isOsWindows() && !CordaSystemUtils.getOsName().toLowerCase().contains("server"))
val devModeConfig = ConfigFactory.parseMap(mapOf("devMode" to smartDevMode))
// Detect the number of cores
val coreCount = Runtime.getRuntime().availableProcessors()
val multiThreadingConfig = configOf("enterpriseConfiguration.tuning.flowThreadPoolSize" to (coreCount * 4).toString(),
"enterpriseConfiguration.tuning.rpcThreadPoolSize" to (coreCount).toString())
val systemOverrides = systemProperties().cordaEntriesOnly()
val environmentOverrides = systemEnvironment().cordaEntriesOnly()
val finalConfig = configOverrides
@ -60,6 +65,7 @@ object ConfigHelper {
.withFallback(databaseConfig) //for database integration tests
.withFallback(appConfig)
.withFallback(devModeConfig) // this needs to be after the appConfig, so it doesn't override the configured devMode
.withFallback(multiThreadingConfig) // this needs to be after the appConfig, so it doesn't override the configured threading.
.withFallback(defaultConfig)
.resolve()

View File

@ -238,7 +238,8 @@ class DriverDSLImpl(
"rpcSettings.adminAddress" to rpcAdminAddress.toString(),
"useTestClock" to useTestClock,
"rpcUsers" to if (users.isEmpty()) defaultRpcUserList else users.map { it.toConfig().root().unwrapped() },
"verifierType" to verifierType.name
"verifierType" to verifierType.name,
"enterpriseConfiguration.tuning.flowThreadPoolSize" to "1"
) + czUrlConfig + customOverrides
val config = NodeConfig(ConfigHelper.loadConfig(
baseDirectory = baseDirectory(name),