4 } = require('../../../lib/index')
5 const { runPoolifierTest
} = require('../../benchmarks-utils')
8 const numberOfTasks
= 1
10 const fixedPool
= new FixedClusterPool(
12 './benchmarks/internal/cluster/worker.js'
15 const fixedPoolTasksQueue
= new FixedClusterPool(
17 './benchmarks/internal/cluster/worker.js',
18 { enableTasksQueue
: true }
21 const fixedPoolLessUsed
= new FixedClusterPool(
23 './benchmarks/internal/cluster/worker.js',
24 { workerChoiceStrategy
: WorkerChoiceStrategies
.LESS_USED
}
27 const fixedPoolLessBusy
= new FixedClusterPool(
29 './benchmarks/internal/cluster/worker.js',
30 { workerChoiceStrategy
: WorkerChoiceStrategies
.LESS_BUSY
}
33 const fixedPoolWeightedRoundRobin
= new FixedClusterPool(
35 './benchmarks/internal/cluster/worker.js',
36 { workerChoiceStrategy
: WorkerChoiceStrategies
.WEIGHTED_ROUND_ROBIN
}
39 const fixedPoolFairShare
= new FixedClusterPool(
41 './benchmarks/internal/cluster/worker.js',
42 { workerChoiceStrategy
: WorkerChoiceStrategies
.FAIR_SHARE
}
45 async
function fixedClusterTest (
46 { tasks
, workerData
} = { tasks
: numberOfTasks
, workerData
: { proof
: 'ok' } }
48 return runPoolifierTest(fixedPool
, { tasks
, workerData
})
51 async
function fixedClusterTasksQueueTest (
52 { tasks
, workerData
} = { tasks
: numberOfTasks
, workerData
: { proof
: 'ok' } }
54 return runPoolifierTest(fixedPoolTasksQueue
, { tasks
, workerData
})
57 async
function fixedClusterTestLessUsed (
58 { tasks
, workerData
} = { tasks
: numberOfTasks
, workerData
: { proof
: 'ok' } }
60 return runPoolifierTest(fixedPoolLessUsed
, { tasks
, workerData
})
63 async
function fixedClusterTestLessBusy (
64 { tasks
, workerData
} = { tasks
: numberOfTasks
, workerData
: { proof
: 'ok' } }
66 return runPoolifierTest(fixedPoolLessBusy
, { tasks
, workerData
})
69 async
function fixedClusterTestWeightedRoundRobin (
70 { tasks
, workerData
} = { tasks
: numberOfTasks
, workerData
: { proof
: 'ok' } }
72 return runPoolifierTest(fixedPoolWeightedRoundRobin
, { tasks
, workerData
})
75 async
function fixedClusterTestFairShare (
76 { tasks
, workerData
} = { tasks
: numberOfTasks
, workerData
: { proof
: 'ok' } }
78 return runPoolifierTest(fixedPoolFairShare
, { tasks
, workerData
})
83 fixedClusterTasksQueueTest
,
84 fixedClusterTestLessUsed
,
85 fixedClusterTestLessBusy
,
86 fixedClusterTestWeightedRoundRobin
,
87 fixedClusterTestFairShare