Skip to content

feat: add configurable worker_count for KBS HTTP server#24

Open
jensfr wants to merge 1 commit into
validatedpatterns:mainfrom
jensfr:feat/kbs-worker-count
Open

feat: add configurable worker_count for KBS HTTP server#24
jensfr wants to merge 1 commit into
validatedpatterns:mainfrom
jensfr:feat/kbs-worker-count

Conversation

@jensfr
Copy link
Copy Markdown

@jensfr jensfr commented May 12, 2026

Summary

On high-core-count systems (e.g., 160-core AMD EPYC 9845 with 320 logical threads), the KBS crashes on startup with "Too many open files".

The KBS uses actix-web, which defaults to one HTTP worker thread per logical CPU core (std::thread::available_parallelism()). With 320 threads, this creates 512 workers that exceed the container's default nofile ulimit (1024 soft / 2048 hard in CRI-O).

Fix

Add an optional kbs.workerCount Helm value that maps to the worker_count field in the KBS [http_server] config section. The KBS binary already supports this field (kbs/src/config.rs:41 and kbs/src/api_server.rs:145-147 in openshift/trustee v1.1.0), but the chart did not expose it.

When set, the KBS uses the specified number of workers. When unset, the existing auto-detection behavior is preserved, maintaining backward compatibility for systems where the default works.

Usage

kbs:
  workerCount: 4

Test plan

  • Tested on 160-core AMD EPYC 9845 (320 threads) — KBS crashed without fix, runs with worker_count = 4
  • Verified backward compatibility — omitting workerCount preserves existing behavior
  • Confirmed KBS logs show starting 4 workers when set

🤖 Generated with Claude Code

The KBS uses actix-web, which defaults to one HTTP worker thread per
logical CPU core (std::thread::available_parallelism). On high-core-
count systems (e.g., 160-core AMD EPYC 9845 with 320 threads), this
creates hundreds of workers that exceed the container's default nofile
ulimit (1024/2048 in CRI-O), causing the KBS to crash on startup with
"Too many open files".

Add an optional kbs.workerCount Helm value that maps to the
worker_count field in the KBS [http_server] config section. When set,
the KBS uses the specified number of workers instead of auto-detecting.
When unset, the existing behavior is preserved.

The KBS binary already supports worker_count in its config
(kbs/src/config.rs:41, kbs/src/api_server.rs:145-147 in openshift/
trustee v1.1.0) but the Helm chart did not expose it.

Signed-off-by: Jens Freimann <jfreiman@redhat.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant