const {
dynamicClusterTest,
dynamicClusterTestFairShare,
- dynamicClusterTestLessRecentlyUsed
+ dynamicClusterTestLessRecentlyUsed,
+ dynamicClusterTestWeightedRoundRobin
} = require('./cluster/dynamic')
const {
fixedClusterTest,
fixedClusterTestFairShare,
- fixedClusterTestLessRecentlyUsed
+ fixedClusterTestLessRecentlyUsed,
+ fixedClusterTestWeightedRoundRobin
} = require('./cluster/fixed')
const {
dynamicThreadTest,
dynamicThreadTestFairShare,
- dynamicThreadTestLessRecentlyUsed
+ dynamicThreadTestLessRecentlyUsed,
+ dynamicThreadTestWeightedRoundRobin
} = require('./thread/dynamic')
const {
fixedThreadTest,
fixedThreadTestFairShare,
- fixedThreadTestLessRecentlyUsed
+ fixedThreadTestLessRecentlyUsed,
+ fixedThreadTestWeightedRoundRobin
} = require('./thread/fixed')
const { LIST_FORMATTER } = require('./benchmark-utils')
.add('Poolifier:Fixed:ThreadPool:LessRecentlyUsed', async function () {
await fixedThreadTestLessRecentlyUsed()
})
+ .add('Poolifier:Fixed:ThreadPool:WeightedRoundRobin', async function () {
+ await fixedThreadTestWeightedRoundRobin()
+ })
.add('Poolifier:Fixed:ThreadPool:FairShare', async function () {
await fixedThreadTestFairShare()
})
.add('Poolifier:Dynamic:ThreadPool:LessRecentlyUsed', async function () {
await dynamicThreadTestLessRecentlyUsed()
})
+ .add('Poolifier:Dynamic:ThreadPool:WeightedRoundRobin', async function () {
+ await dynamicThreadTestWeightedRoundRobin()
+ })
.add('Poolifier:Dynamic:ThreadPool:FairShare', async function () {
await dynamicThreadTestFairShare()
})
.add('Poolifier:Fixed:ClusterPool:LessRecentlyUsed', async function () {
await fixedClusterTestLessRecentlyUsed()
})
+ .add('Poolifier:Fixed:ClusterPool:WeightedRoundRobin', async function () {
+ await fixedClusterTestWeightedRoundRobin
+ })
.add('Poolifier:Fixed:ClusterPool:FairShare', async function () {
await fixedClusterTestFairShare()
})
.add('Poolifier:Dynamic:ClusterPool:LessRecentlyUsed', async function () {
await dynamicClusterTestLessRecentlyUsed()
})
+ .add('Poolifier:Dynamic:ClusterPool:WeightedRoundRobin', async function () {
+ await dynamicClusterTestWeightedRoundRobin
+ })
.add('Poolifier:Dynamic:ClusterPool:FairShare', async function () {
await dynamicClusterTestFairShare()
})
{ 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,
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' } }
) {
module.exports = {
dynamicClusterTest,
- dynamicClusterTestFairShare,
- dynamicClusterTestLessRecentlyUsed
+ dynamicClusterTestLessRecentlyUsed,
+ dynamicClusterTestWeightedRoundRobin,
+ dynamicClusterTestFairShare
}
{ 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',
return runPoolifierTest(fixedPoolLessRecentlyUsed, { tasks, workerData })
}
+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' } }
) {
module.exports = {
fixedClusterTest,
- fixedClusterTestFairShare,
- fixedClusterTestLessRecentlyUsed
+ fixedClusterTestLessRecentlyUsed,
+ fixedClusterTestWeightedRoundRobin,
+ fixedClusterTestFairShare
}
{ workerChoiceStrategy: WorkerChoiceStrategies.LESS_RECENTLY_USED }
)
+const dynamicPoolWeightedRoundRobin = new DynamicThreadPool(
+ size / 2,
+ size * 3,
+ './benchmarks/internal/thread/worker.js',
+ { workerChoiceStrategy: WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN }
+)
+
const dynamicPoolFairShare = new DynamicThreadPool(
size / 2,
size * 3,
return runPoolifierTest(dynamicPoolLessRecentlyUsed, { tasks, workerData })
}
+async function dynamicThreadTestWeightedRoundRobin (
+ { tasks, workerData } = { tasks: numberOfTasks, workerData: { proof: 'ok' } }
+) {
+ return runPoolifierTest(dynamicPoolWeightedRoundRobin, { tasks, workerData })
+}
+
async function dynamicThreadTestFairShare (
{ tasks, workerData } = { tasks: numberOfTasks, workerData: { proof: 'ok' } }
) {
module.exports = {
dynamicThreadTest,
- dynamicThreadTestFairShare,
- dynamicThreadTestLessRecentlyUsed
+ dynamicThreadTestLessRecentlyUsed,
+ dynamicThreadTestWeightedRoundRobin,
+ dynamicThreadTestFairShare
}
{ workerChoiceStrategy: WorkerChoiceStrategies.LESS_RECENTLY_USED }
)
+const fixedPoolWeightedRoundRobin = new FixedThreadPool(
+ size,
+ './benchmarks/internal/thread/worker.js',
+ { workerChoiceStrategy: WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN }
+)
+
const fixedPoolFairShare = new FixedThreadPool(
size,
'./benchmarks/internal/thread/worker.js',
return runPoolifierTest(fixedPoolLessRecentlyUsed, { tasks, workerData })
}
+async function fixedThreadTestWeightedRoundRobin (
+ { tasks, workerData } = { tasks: numberOfTasks, workerData: { proof: 'ok' } }
+) {
+ return runPoolifierTest(fixedPoolWeightedRoundRobin, { tasks, workerData })
+}
+
async function fixedThreadTestFairShare (
{ tasks, workerData } = { tasks: numberOfTasks, workerData: { proof: 'ok' } }
) {
module.exports = {
fixedThreadTest,
- fixedThreadTestFairShare,
- fixedThreadTestLessRecentlyUsed
+ fixedThreadTestLessRecentlyUsed,
+ fixedThreadTestWeightedRoundRobin,
+ fixedThreadTestFairShare
}