X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=benchmarks%2Finternal%2Fcluster%2Ffixed.js;h=69e4a14870013bd5f3136d8ecb25309c9d93c163;hb=168c526f6e6913506e56f7d5107335c3d3d42938;hp=fc4cc3ac8dc545ba4b8d530401b19ac396f1f02c;hpb=e843b9042b77e0e4e17c193820a3e05ffc92cffe;p=poolifier.git diff --git a/benchmarks/internal/cluster/fixed.js b/benchmarks/internal/cluster/fixed.js index fc4cc3ac..69e4a148 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 @@ -12,10 +12,22 @@ const fixedPool = new FixedClusterPool( './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( + size, + './benchmarks/internal/cluster/worker.js', + { workerChoiceStrategy: WorkerChoiceStrategies.FAIR_SHARE } ) async function fixedClusterTest ( @@ -24,10 +36,27 @@ async function fixedClusterTest ( return runPoolifierTest(fixedPool, { tasks, workerData }) } -async function fixedClusterTestLessRecentlyUsed ( +async function fixedClusterTestLessUsed ( { tasks, workerData } = { tasks: numberOfTasks, workerData: { proof: 'ok' } } ) { - return runPoolifierTest(fixedPoolLessRecentlyUsed, { tasks, workerData }) + return runPoolifierTest(fixedPoolLessUsed, { 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, + fixedClusterTestLessUsed, + fixedClusterTestWeightedRoundRobin, + fixedClusterTestFairShare +}