From 2fe5bae8a7ae558998a2b9702a266c247c9dc47c Mon Sep 17 00:00:00 2001 From: Rick Parker Date: Fri, 22 Jun 2018 16:39:17 +0100 Subject: [PATCH] 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 --- .../main/kotlin/net/corda/node/internal/EnterpriseNode.kt | 2 ++ .../net/corda/node/services/config/ConfigUtilities.kt | 6 ++++++ .../kotlin/net/corda/testing/node/internal/DriverDSLImpl.kt | 3 ++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/node/src/main/kotlin/net/corda/node/internal/EnterpriseNode.kt b/node/src/main/kotlin/net/corda/node/internal/EnterpriseNode.kt index d4a11e9b65..78cb8814b8 100644 --- a/node/src/main/kotlin/net/corda/node/internal/EnterpriseNode.kt +++ b/node/src/main/kotlin/net/corda/node/internal/EnterpriseNode.kt @@ -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) } } diff --git a/node/src/main/kotlin/net/corda/node/services/config/ConfigUtilities.kt b/node/src/main/kotlin/net/corda/node/services/config/ConfigUtilities.kt index 11b8d8e213..254d02a978 100644 --- a/node/src/main/kotlin/net/corda/node/services/config/ConfigUtilities.kt +++ b/node/src/main/kotlin/net/corda/node/services/config/ConfigUtilities.kt @@ -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() diff --git a/testing/node-driver/src/main/kotlin/net/corda/testing/node/internal/DriverDSLImpl.kt b/testing/node-driver/src/main/kotlin/net/corda/testing/node/internal/DriverDSLImpl.kt index 36f7264c75..ecf0be3f17 100644 --- a/testing/node-driver/src/main/kotlin/net/corda/testing/node/internal/DriverDSLImpl.kt +++ b/testing/node-driver/src/main/kotlin/net/corda/testing/node/internal/DriverDSLImpl.kt @@ -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),