콘텐츠로 이동

전역 동시성

Source URL: https://docs.bullmq.io/guide/queues/global-concurrency

전역 동시성 계수는 모든 worker 인스턴스 전체에서 병렬로 처리할 수 있는 job 수를 결정하는 queue 옵션입니다.

import { Queue } from 'bullmq';
await queue.setGlobalConcurrency(4);

그리고 이 값을 가져오려면:

const globalConcurrency = await queue.getGlobalConcurrency();

{% hint style=“info” %} worker에서 동시성 수준을 선택하더라도 전역 동시성을 덮어쓰지는 않습니다. 이는 특정 worker가 병렬로 처리할 수 있는 최대 job 수를 의미할 뿐이며, 전역 동시성 값을 절대 초과할 수 없습니다. {% endhint %}

다음 메서드를 사용해 수행할 수 있습니다:

await queue.removeGlobalConcurrency();