4 } = require('../../../lib/index')
5 const { runPoolifierTest
} = require('../benchmark-utils')
8 const numberOfTasks
= 1
10 const fixedPool
= new FixedClusterPool(
12 './benchmarks/internal/cluster/worker.js'
15 const fixedPoolLessRecentlyUsed
= new FixedClusterPool(
17 './benchmarks/internal/cluster/worker.js',
18 { workerChoiceStrategy
: WorkerChoiceStrategies
.LESS_RECENTLY_USED
}
21 const fixedPoolWeightedRoundRobin
= new FixedClusterPool(
23 './benchmarks/internal/cluster/worker.js',
24 { workerChoiceStrategy
: WorkerChoiceStrategies
.WEIGHTED_ROUND_ROBIN
}
27 const fixedPoolFairShare
= new FixedClusterPool(
29 './benchmarks/internal/cluster/worker.js',
30 { workerChoiceStrategy
: WorkerChoiceStrategies
.FAIR_SHARE
}
33 async
function fixedClusterTest (
34 { tasks
, workerData
} = { tasks
: numberOfTasks
, workerData
: { proof
: 'ok' } }
36 return runPoolifierTest(fixedPool
, { tasks
, workerData
})
39 async
function fixedClusterTestLessRecentlyUsed (
40 { tasks
, workerData
} = { tasks
: numberOfTasks
, workerData
: { proof
: 'ok' } }
42 return runPoolifierTest(fixedPoolLessRecentlyUsed
, { tasks
, workerData
})
45 async
function fixedClusterTestWeightedRoundRobin (
46 { tasks
, workerData
} = { tasks
: numberOfTasks
, workerData
: { proof
: 'ok' } }
48 return runPoolifierTest(fixedPoolWeightedRoundRobin
, { tasks
, workerData
})
51 async
function fixedClusterTestFairShare (
52 { tasks
, workerData
} = { tasks
: numberOfTasks
, workerData
: { proof
: 'ok' } }
54 return runPoolifierTest(fixedPoolFairShare
, { tasks
, workerData
})
59 fixedClusterTestLessRecentlyUsed
,
60 fixedClusterTestWeightedRoundRobin
,
61 fixedClusterTestFairShare