feat: add less busy worker choice strategy to internal benchmarks
[poolifier.git] / benchmarks / internal / cluster / fixed.js
index 69e4a14870013bd5f3136d8ecb25309c9d93c163..7e31a838eceaaa271abcc7cf9a277a70eb6bbc75 100644 (file)
@@ -18,6 +18,12 @@ const fixedPoolLessUsed = new FixedClusterPool(
   { workerChoiceStrategy: WorkerChoiceStrategies.LESS_USED }
 )
 
+const fixedPoolLessBusy = new FixedClusterPool(
+  size,
+  './benchmarks/internal/cluster/worker.js',
+  { workerChoiceStrategy: WorkerChoiceStrategies.LESS_BUSY }
+)
+
 const fixedPoolWeightedRoundRobin = new FixedClusterPool(
   size,
   './benchmarks/internal/cluster/worker.js',
@@ -42,6 +48,12 @@ async function fixedClusterTestLessUsed (
   return runPoolifierTest(fixedPoolLessUsed, { tasks, workerData })
 }
 
+async function fixedClusterTestLessBusy (
+  { tasks, workerData } = { tasks: numberOfTasks, workerData: { proof: 'ok' } }
+) {
+  return runPoolifierTest(fixedPoolLessBusy, { tasks, workerData })
+}
+
 async function fixedClusterTestWeightedRoundRobin (
   { tasks, workerData } = { tasks: numberOfTasks, workerData: { proof: 'ok' } }
 ) {
@@ -57,6 +69,7 @@ async function fixedClusterTestFairShare (
 module.exports = {
   fixedClusterTest,
   fixedClusterTestLessUsed,
+  fixedClusterTestLessBusy,
   fixedClusterTestWeightedRoundRobin,
   fixedClusterTestFairShare
 }