4 } = require('../../../lib/index')
5 const { runPoolifierTest
} = require('../../benchmarks-utils')
8 const numberOfTasks
= 1
10 const dynamicPool
= new DynamicClusterPool(
13 './benchmarks/internal/cluster/worker.js'
16 const dynamicPoolLessUsed
= new DynamicClusterPool(
19 './benchmarks/internal/cluster/worker.js',
20 { workerChoiceStrategy
: WorkerChoiceStrategies
.LESS_USED
}
23 const dynamicPoolLessBusy
= new DynamicClusterPool(
26 './benchmarks/internal/cluster/worker.js',
27 { workerChoiceStrategy
: WorkerChoiceStrategies
.LESS_BUSY
}
30 const dynamicPoolWeightedRoundRobin
= new DynamicClusterPool(
33 './benchmarks/internal/cluster/worker.js',
34 { workerChoiceStrategy
: WorkerChoiceStrategies
.WEIGHTED_ROUND_ROBIN
}
37 const dynamicPoolFairShare
= new DynamicClusterPool(
40 './benchmarks/internal/cluster/worker.js',
41 { workerChoiceStrategy
: WorkerChoiceStrategies
.FAIR_SHARE
}
44 async
function dynamicClusterTest (
45 { tasks
, workerData
} = { tasks
: numberOfTasks
, workerData
: { proof
: 'ok' } }
47 return runPoolifierTest(dynamicPool
, { tasks
, workerData
})
50 async
function dynamicClusterTestLessUsed (
51 { tasks
, workerData
} = { tasks
: numberOfTasks
, workerData
: { proof
: 'ok' } }
53 return runPoolifierTest(dynamicPoolLessUsed
, { tasks
, workerData
})
56 async
function dynamicClusterTestLessBusy (
57 { tasks
, workerData
} = { tasks
: numberOfTasks
, workerData
: { proof
: 'ok' } }
59 return runPoolifierTest(dynamicPoolLessBusy
, { tasks
, workerData
})
62 async
function dynamicClusterTestWeightedRoundRobin (
63 { tasks
, workerData
} = { tasks
: numberOfTasks
, workerData
: { proof
: 'ok' } }
65 return runPoolifierTest(dynamicPoolWeightedRoundRobin
, { tasks
, workerData
})
68 async
function dynamicClusterTestFairShare (
69 { tasks
, workerData
} = { tasks
: numberOfTasks
, workerData
: { proof
: 'ok' } }
71 return runPoolifierTest(dynamicPoolFairShare
, { tasks
, workerData
})
76 dynamicClusterTestLessUsed
,
77 dynamicClusterTestLessBusy
,
78 dynamicClusterTestWeightedRoundRobin
,
79 dynamicClusterTestFairShare