FixedClusterPool,
WorkerChoiceStrategies
} = require('../../../lib/index')
-const { runPoolifierTest } = require('../benchmark-utils')
+const { runPoolifierTest } = require('../../benchmarks-utils')
const size = 30
const numberOfTasks = 1
'./benchmarks/internal/cluster/worker.js'
)
-const fixedPoolLessRecentlyUsed = new FixedClusterPool(
+const fixedPoolLessUsed = new FixedClusterPool(
size,
'./benchmarks/internal/cluster/worker.js',
- { workerChoiceStrategy: WorkerChoiceStrategies.LESS_RECENTLY_USED }
+ { workerChoiceStrategy: WorkerChoiceStrategies.LESS_USED }
+)
+
+const fixedPoolWeightedRoundRobin = new FixedClusterPool(
+ size,
+ './benchmarks/internal/cluster/worker.js',
+ { workerChoiceStrategy: WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN }
)
const fixedPoolFairShare = new FixedClusterPool(
return runPoolifierTest(fixedPool, { tasks, workerData })
}
-async function fixedClusterTestLessRecentlyUsed (
+async function fixedClusterTestLessUsed (
+ { tasks, workerData } = { tasks: numberOfTasks, workerData: { proof: 'ok' } }
+) {
+ return runPoolifierTest(fixedPoolLessUsed, { tasks, workerData })
+}
+
+async function fixedClusterTestWeightedRoundRobin (
{ tasks, workerData } = { tasks: numberOfTasks, workerData: { proof: 'ok' } }
) {
- return runPoolifierTest(fixedPoolLessRecentlyUsed, { tasks, workerData })
+ return runPoolifierTest(fixedPoolWeightedRoundRobin, { tasks, workerData })
}
async function fixedClusterTestFairShare (
module.exports = {
fixedClusterTest,
- fixedClusterTestFairShare,
- fixedClusterTestLessRecentlyUsed
+ fixedClusterTestLessUsed,
+ fixedClusterTestWeightedRoundRobin,
+ fixedClusterTestFairShare
}