repositories
/
poolifier.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
build(deps-dev): apply dependencies update
[poolifier.git]
/
benchmarks
/
internal
/
cluster
/
dynamic.js
diff --git
a/benchmarks/internal/cluster/dynamic.js
b/benchmarks/internal/cluster/dynamic.js
index 581bf4acf086073ed459ea6f30b65af0249ab021..105bbdaa9d77eef540cfa361e6d794095b400363 100644
(file)
--- a/
benchmarks/internal/cluster/dynamic.js
+++ b/
benchmarks/internal/cluster/dynamic.js
@@
-2,7
+2,7
@@
const {
DynamicClusterPool,
WorkerChoiceStrategies
} = require('../../../lib/index')
DynamicClusterPool,
WorkerChoiceStrategies
} = require('../../../lib/index')
-const { runPoolifierTest } = require('../
benchmark
-utils')
+const { runPoolifierTest } = require('../
../benchmarks
-utils')
const size = 30
const numberOfTasks = 1
const size = 30
const numberOfTasks = 1
@@
-20,6
+20,13
@@
const dynamicPoolLessRecentlyUsed = new DynamicClusterPool(
{ workerChoiceStrategy: WorkerChoiceStrategies.LESS_RECENTLY_USED }
)
{ 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,
const dynamicPoolFairShare = new DynamicClusterPool(
size / 2,
size * 3,
@@
-39,6
+46,12
@@
async function dynamicClusterTestLessRecentlyUsed (
return runPoolifierTest(dynamicPoolLessRecentlyUsed, { tasks, workerData })
}
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' } }
) {
async function dynamicClusterTestFairShare (
{ tasks, workerData } = { tasks: numberOfTasks, workerData: { proof: 'ok' } }
) {
@@
-47,6
+60,7
@@
async function dynamicClusterTestFairShare (
module.exports = {
dynamicClusterTest,
module.exports = {
dynamicClusterTest,
- dynamicClusterTestFairShare,
- dynamicClusterTestLessRecentlyUsed
+ dynamicClusterTestLessRecentlyUsed,
+ dynamicClusterTestWeightedRoundRobin,
+ dynamicClusterTestFairShare
}
}