From 5128257cdcf741f3e2d7f779953cfae4215623d0 Mon Sep 17 00:00:00 2001 From: Zac Spitzer Date: Mon, 16 Dec 2024 14:41:27 +0100 Subject: [PATCH] limit threads to number of availableProcessors() --- custom/benchmark/index.cfm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/custom/benchmark/index.cfm b/custom/benchmark/index.cfm index df4aff7..5ac1c80 100644 --- a/custom/benchmark/index.cfm +++ b/custom/benchmark/index.cfm @@ -21,7 +21,8 @@ appSettings = getApplicationSettings(); systemOutput("Precise Math: " & (appSettings.preciseMath ?: "not supported"), true); - + max_threads = createObject("java", "java.lang.Runtime").getRuntime().availableProcessors(); + systemOutput("Using [#max_threads#] parallel threads, i.e. java.lang.Runtime.availableProcessors()", true); systemOutput("Sleeping for 5s, allow server to startup and settle", true); systemOutput("", true); sleep( 5000 ); // initial time to settle @@ -41,7 +42,7 @@ _internalRequest( template: template ); - }, true ); + }, true, max_threads ); systemOutput( "Sleeping 2s first, after warmup", true ); sleep( 2000 ); // time to settle @@ -54,7 +55,7 @@ template: template ); arguments._arr[ arguments.idx ] = getTickCount(units) - start; - }, true); + }, true, max_threads ); } catch ( e ){ systemOutput( e, true ); echo(e);