X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=benchmarks%2Finternal%2Fcluster%2Fdynamic.js;h=475ba9d79b953fdfabf075010d94ddb979fe93eb;hb=refs%2Ftags%2Fv2.4.8;hp=581bf4acf086073ed459ea6f30b65af0249ab021;hpb=23ff945ac0bc3b9bcf98c6491872cffaac805b73;p=poolifier.git diff --git a/benchmarks/internal/cluster/dynamic.js b/benchmarks/internal/cluster/dynamic.js index 581bf4ac..475ba9d7 100644 --- a/benchmarks/internal/cluster/dynamic.js +++ b/benchmarks/internal/cluster/dynamic.js @@ -2,7 +2,7 @@ const { DynamicClusterPool, WorkerChoiceStrategies } = require('../../../lib/index') -const { runPoolifierTest } = require('../benchmark-utils') +const { runPoolifierTest } = require('../../benchmarks-utils') const size = 30 const numberOfTasks = 1 @@ -13,11 +13,25 @@ const dynamicPool = new DynamicClusterPool( './benchmarks/internal/cluster/worker.js' ) -const dynamicPoolLessRecentlyUsed = new DynamicClusterPool( +const dynamicPoolLessUsed = new DynamicClusterPool( size / 2, size * 3, './benchmarks/internal/cluster/worker.js', - { workerChoiceStrategy: WorkerChoiceStrategies.LESS_RECENTLY_USED } + { workerChoiceStrategy: WorkerChoiceStrategies.LESS_USED } +) + +const dynamicPoolLessBusy = new DynamicClusterPool( + size / 2, + size * 3, + './benchmarks/internal/cluster/worker.js', + { workerChoiceStrategy: WorkerChoiceStrategies.LESS_BUSY } +) + +const dynamicPoolWeightedRoundRobin = new DynamicClusterPool( + size / 2, + size * 3, + './benchmarks/internal/cluster/worker.js', + { workerChoiceStrategy: WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN } ) const dynamicPoolFairShare = new DynamicClusterPool( @@ -33,10 +47,22 @@ async function dynamicClusterTest ( return runPoolifierTest(dynamicPool, { tasks, workerData }) } -async function dynamicClusterTestLessRecentlyUsed ( +async function dynamicClusterTestLessUsed ( + { tasks, workerData } = { tasks: numberOfTasks, workerData: { proof: 'ok' } } +) { + return runPoolifierTest(dynamicPoolLessUsed, { tasks, workerData }) +} + +async function dynamicClusterTestLessBusy ( + { tasks, workerData } = { tasks: numberOfTasks, workerData: { proof: 'ok' } } +) { + return runPoolifierTest(dynamicPoolLessBusy, { tasks, workerData }) +} + +async function dynamicClusterTestWeightedRoundRobin ( { tasks, workerData } = { tasks: numberOfTasks, workerData: { proof: 'ok' } } ) { - return runPoolifierTest(dynamicPoolLessRecentlyUsed, { tasks, workerData }) + return runPoolifierTest(dynamicPoolWeightedRoundRobin, { tasks, workerData }) } async function dynamicClusterTestFairShare ( @@ -47,6 +73,8 @@ async function dynamicClusterTestFairShare ( module.exports = { dynamicClusterTest, - dynamicClusterTestFairShare, - dynamicClusterTestLessRecentlyUsed + dynamicClusterTestLessUsed, + dynamicClusterTestLessBusy, + dynamicClusterTestWeightedRoundRobin, + dynamicClusterTestFairShare }