forked from FoundKeyGang/FoundKey
Tune worker/job counts (#5346)
* デフォルトのワーカー数を1に * Tune default job count
This commit is contained in:
parent
ab6a84cd45
commit
6a0affcec1
4 changed files with 11 additions and 4 deletions
|
@ -116,8 +116,12 @@ autoAdmin: true
|
||||||
# Whether disable HSTS
|
# Whether disable HSTS
|
||||||
#disableHsts: true
|
#disableHsts: true
|
||||||
|
|
||||||
# Clustering
|
# Number of worker processes
|
||||||
#clusterLimit: 1
|
#clusterLimit: 1
|
||||||
|
|
||||||
|
# Job concurrency per worker
|
||||||
|
# deliverJobConcurrency: 128;
|
||||||
|
# inboxJobConcurrency: 16;
|
||||||
|
|
||||||
# IP address family used for outgoing request (ipv4, ipv6 or dual)
|
# IP address family used for outgoing request (ipv4, ipv6 or dual)
|
||||||
#outgoingAddressFamily: ipv4
|
#outgoingAddressFamily: ipv4
|
||||||
|
|
|
@ -159,7 +159,7 @@ async function init(): Promise<Config> {
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function spawnWorkers(limit: number = Infinity) {
|
async function spawnWorkers(limit: number = 1) {
|
||||||
const workers = Math.min(limit, os.cpus().length);
|
const workers = Math.min(limit, os.cpus().length);
|
||||||
bootLogger.info(`Starting ${workers} worker${workers === 1 ? '' : 's'}...`);
|
bootLogger.info(`Starting ${workers} worker${workers === 1 ? '' : 's'}...`);
|
||||||
await Promise.all([...Array(workers)].map(spawnWorker));
|
await Promise.all([...Array(workers)].map(spawnWorker));
|
||||||
|
|
|
@ -42,6 +42,9 @@ export type Source = {
|
||||||
id: string;
|
id: string;
|
||||||
|
|
||||||
outgoingAddressFamily?: 'ipv4' | 'ipv6' | 'dual';
|
outgoingAddressFamily?: 'ipv4' | 'ipv6' | 'dual';
|
||||||
|
|
||||||
|
deliverJobConcurrency?: number;
|
||||||
|
inboxJobConcurrency?: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -203,8 +203,8 @@ export function createCleanRemoteFilesJob() {
|
||||||
|
|
||||||
export default function() {
|
export default function() {
|
||||||
if (!program.onlyServer) {
|
if (!program.onlyServer) {
|
||||||
deliverQueue.process(128, processDeliver);
|
deliverQueue.process(config.deliverJobConcurrency || 128, processDeliver);
|
||||||
inboxQueue.process(128, processInbox);
|
inboxQueue.process(config.inboxJobConcurrency || 16, processInbox);
|
||||||
processDb(dbQueue);
|
processDb(dbQueue);
|
||||||
procesObjectStorage(objectStorageQueue);
|
procesObjectStorage(objectStorageQueue);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue