X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=benchmarks%2Finternal%2Fcluster%2Ffixed.js;h=da691aa9237a387d1b6d2cfe4ffe01d64cf506f9;hb=b4e757784e2b9ffe2c22b65b21e8bf665abd9f56;hp=fc4cc3ac8dc545ba4b8d530401b19ac396f1f02c;hpb=e843b9042b77e0e4e17c193820a3e05ffc92cffe;p=poolifier.git diff --git a/benchmarks/internal/cluster/fixed.js b/benchmarks/internal/cluster/fixed.js index fc4cc3ac..da691aa9 100644 --- a/benchmarks/internal/cluster/fixed.js +++ b/benchmarks/internal/cluster/fixed.js @@ -2,7 +2,7 @@ const { FixedClusterPool, WorkerChoiceStrategies } = require('../../../lib/index') -const { runPoolifierTest } = require('../benchmark-utils') +const { runPoolifierTest } = require('../../benchmarks-utils') const size = 30 const numberOfTasks = 1 @@ -18,6 +18,18 @@ const fixedPoolLessRecentlyUsed = new FixedClusterPool( { workerChoiceStrategy: WorkerChoiceStrategies.LESS_RECENTLY_USED } ) +const fixedPoolWeightedRoundRobin = new FixedClusterPool( + size, + './benchmarks/internal/cluster/worker.js', + { workerChoiceStrategy: WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN } +) + +const fixedPoolFairShare = new FixedClusterPool( + size, + './benchmarks/internal/cluster/worker.js', + { workerChoiceStrategy: WorkerChoiceStrategies.FAIR_SHARE } +) + async function fixedClusterTest ( { tasks, workerData } = { tasks: numberOfTasks, workerData: { proof: 'ok' } } ) { @@ -30,4 +42,21 @@ async function fixedClusterTestLessRecentlyUsed ( return runPoolifierTest(fixedPoolLessRecentlyUsed, { tasks, workerData }) } -module.exports = { fixedClusterTest, fixedClusterTestLessRecentlyUsed } +async function fixedClusterTestWeightedRoundRobin ( + { tasks, workerData } = { tasks: numberOfTasks, workerData: { proof: 'ok' } } +) { + return runPoolifierTest(fixedPoolWeightedRoundRobin, { tasks, workerData }) +} + +async function fixedClusterTestFairShare ( + { tasks, workerData } = { tasks: numberOfTasks, workerData: { proof: 'ok' } } +) { + return runPoolifierTest(fixedPoolFairShare, { tasks, workerData }) +} + +module.exports = { + fixedClusterTest, + fixedClusterTestLessRecentlyUsed, + fixedClusterTestWeightedRoundRobin, + fixedClusterTestFairShare +}