perf: Increase default concurrency on worker

This commit is contained in:
Tom Moor
2024-09-02 09:31:18 -04:00
parent 58eb55efb3
commit d65037d4e7
2 changed files with 22 additions and 0 deletions

View File

@@ -406,6 +406,24 @@ export class Environment {
environment.SOURCE_COMMIT || environment.SOURCE_VERSION
);
/**
* The maximum number of concurrent events processed per-worker. To get total
* concurrency you should multiply this by the number of workers.
*/
@IsOptional()
@IsNumber()
public WORKER_CONCURRENCY_EVENTS =
this.toOptionalNumber(environment.WORKER_CONCURRENCY_EVENTS) ?? 10;
/**
* The maximum number of concurrent tasks processed per-worker. To get total
* concurrency you should multiply this by the number of workers.
*/
@IsOptional()
@IsNumber()
public WORKER_CONCURRENCY_TASKS =
this.toOptionalNumber(environment.WORKER_CONCURRENCY_TASKS) ?? 10;
/**
* A boolean switch to toggle the rate limiter at application web server.
*/

View File

@@ -1,3 +1,4 @@
import env from "@server/env";
import Logger from "@server/logging/Logger";
import { setResource, addTags } from "@server/logging/tracer";
import { traceFunction } from "@server/logging/tracing";
@@ -18,6 +19,7 @@ export default function init() {
// This queue processes the global event bus
globalEventQueue
.process(
env.WORKER_CONCURRENCY_EVENTS,
traceFunction({
serviceName: "worker",
spanName: "process",
@@ -79,6 +81,7 @@ export default function init() {
// as unapplicable events were filtered in the global event queue above.
processorEventQueue
.process(
env.WORKER_CONCURRENCY_EVENTS,
traceFunction({
serviceName: "worker",
spanName: "process",
@@ -123,6 +126,7 @@ export default function init() {
// Jobs for async tasks are processed here.
taskQueue
.process(
env.WORKER_CONCURRENCY_TASKS,
traceFunction({
serviceName: "worker",
spanName: "process",