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 fixedPoolLessUsed
= new FixedClusterPool(
17 './benchmarks/internal/cluster/worker.js',
18 { workerChoiceStrategy
: WorkerChoiceStrategies
.LESS_USED
}
21 const fixedPoolLessBusy
= new FixedClusterPool(
23 './benchmarks/internal/cluster/worker.js',
24 { workerChoiceStrategy
: WorkerChoiceStrategies
.LESS_BUSY
}
27 const fixedPoolWeightedRoundRobin
= new FixedClusterPool(
29 './benchmarks/internal/cluster/worker.js',
30 { workerChoiceStrategy
: WorkerChoiceStrategies
.WEIGHTED_ROUND_ROBIN
}
33 const fixedPoolFairShare
= new FixedClusterPool(
35 './benchmarks/internal/cluster/worker.js',
36 { workerChoiceStrategy
: WorkerChoiceStrategies
.FAIR_SHARE
}
39 async
function fixedClusterTest (
40 { tasks
, workerData
} = { tasks
: numberOfTasks
, workerData
: { proof
: 'ok' } }
42 return runPoolifierTest(fixedPool
, { tasks
, workerData
})
45 async
function fixedClusterTestLessUsed (
46 { tasks
, workerData
} = { tasks
: numberOfTasks
, workerData
: { proof
: 'ok' } }
48 return runPoolifierTest(fixedPoolLessUsed
, { tasks
, workerData
})
51 async
function fixedClusterTestLessBusy (
52 { tasks
, workerData
} = { tasks
: numberOfTasks
, workerData
: { proof
: 'ok' } }
54 return runPoolifierTest(fixedPoolLessBusy
, { tasks
, workerData
})
57 async
function fixedClusterTestWeightedRoundRobin (
58 { tasks
, workerData
} = { tasks
: numberOfTasks
, workerData
: { proof
: 'ok' } }
60 return runPoolifierTest(fixedPoolWeightedRoundRobin
, { tasks
, workerData
})
63 async
function fixedClusterTestFairShare (
64 { tasks
, workerData
} = { tasks
: numberOfTasks
, workerData
: { proof
: 'ok' } }
66 return runPoolifierTest(fixedPoolFairShare
, { tasks
, workerData
})
71 fixedClusterTestLessUsed
,
72 fixedClusterTestLessBusy
,
73 fixedClusterTestWeightedRoundRobin
,
74 fixedClusterTestFairShare