X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=benchmarks%2Finternal%2Fcluster%2Fdynamic.js;h=105bbdaa9d77eef540cfa361e6d794095b400363;hb=58a2073b1d033283931fbe98c3b18c8f8199e1b9;hp=581bf4acf086073ed459ea6f30b65af0249ab021;hpb=23ff945ac0bc3b9bcf98c6491872cffaac805b73;p=poolifier.git diff --git a/benchmarks/internal/cluster/dynamic.js b/benchmarks/internal/cluster/dynamic.js index 581bf4ac..105bbdaa 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 @@ -20,6 +20,13 @@ const dynamicPoolLessRecentlyUsed = new DynamicClusterPool( { workerChoiceStrategy: WorkerChoiceStrategies.LESS_RECENTLY_USED } ) +const dynamicPoolWeightedRoundRobin = new DynamicClusterPool( + size / 2, + size * 3, + './benchmarks/internal/cluster/worker.js', + { workerChoiceStrategy: WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN } +) + const dynamicPoolFairShare = new DynamicClusterPool( size / 2, size * 3, @@ -39,6 +46,12 @@ async function dynamicClusterTestLessRecentlyUsed ( return runPoolifierTest(dynamicPoolLessRecentlyUsed, { tasks, workerData }) } +async function dynamicClusterTestWeightedRoundRobin ( + { tasks, workerData } = { tasks: numberOfTasks, workerData: { proof: 'ok' } } +) { + return runPoolifierTest(dynamicPoolWeightedRoundRobin, { tasks, workerData }) +} + async function dynamicClusterTestFairShare ( { tasks, workerData } = { tasks: numberOfTasks, workerData: { proof: 'ok' } } ) { @@ -47,6 +60,7 @@ async function dynamicClusterTestFairShare ( module.exports = { dynamicClusterTest, - dynamicClusterTestFairShare, - dynamicClusterTestLessRecentlyUsed + dynamicClusterTestLessRecentlyUsed, + dynamicClusterTestWeightedRoundRobin, + dynamicClusterTestFairShare }