Skip to content

perf(k8s): embedding-only tiers use one CPU thread #3518

Description

@dan-petty

Problem

Each embedding-only instance uses 12 CPU cores under load, and the work runs on its GPU. llama-server starts with its default thread count, and its threads spin. On a node with two instances, that is 24 busy cores, against a request of 2 CPUs each.

Expected

An embedding-only tier sets LLAMA_ARG_THREADS: "1", so it uses about 1 core with no loss of speed.

Acceptance criteria

  • devops ai gateway render writes LLAMA_ARG_THREADS: "1" for a tier at or below embedding_only, and a test holds it.
  • A tier newer than the threshold keeps its default thread count.
  • The documents and the gateway comment give the measured numbers, and say why embeddings keep simple-shuffle.

Evidence

Measured on ollama/ollama:0.40.12 with one Quadro P6000, with a batch of 32 chunks of about 300 tokens, and CPU from the cgroup cpu.stat:

num_thread Median CPU core-seconds per batch Mean cores
default 1.69 s 20.7 12.2
1 1.70 s 2.0 1.2
2 1.70 s 2.8 1.7
4 1.69 s 4.5 2.6
8 1.69 s 7.8 4.6
16 1.70 s 14.2 8.4
  • LLAMA_ARG_THREADS=1 in a temporary pod gave 1.69 s, 2.0 core-seconds and 1.2 cores.
  • Vectors with num_thread 1 and the default were exactly equal.
  • The num_thread request option reloads the model (4.3 s) when a caller sends another value, so the environment variable is the better place.

Existing tool considered

The llama-server environment variable LLAMA_ARG_THREADS, as ollama-64gib already sets LLAMA_ARG_CACHE_RAM.

Related

Related: #3501

Activity

  1. added
    source/agent
    type/infra
    scope/k8s
    status/new
    value/medium
    effort/low
    on Nov 4, 2026
  2. dan-petty commented on Nov 4, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/infra. The perf prefix of the title gives the type.
    • Scope: scope/k8s. The (k8s) scope of the title gives the scope.
    • Priority: P2-Medium. Saves 10 CPU cores per instance with no speed loss, but does not fix a failure or security issue.
    • Value: Medium. Reduces wasted CPU cores on shared nodes without affecting embedding latency or correctness.
    • Effort: Low. Set one environment variable in the render function, add a test, and update documentation.
    • Related: feat(k8s): GPU thresholds set embedding-only and per-GPU tiers #3501, which asks for a different change. #3501 creates the embedding-only tier categories; this candidate sets a CPU thread limit on those tiers, a different configuration change on the same area.
  3. added
    priority/p2-medium
    owner/agent
    status/in-progress
    status/in-review
    and removed
    status/new
    status/in-progress
    on Nov 4, 2026
  4. removed
    status/in-review
    owner/agent
    on Nov 4, 2026
  5. devops-cli-service commented on Nov 4, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-04 21:54 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/lowpriority/p2-mediumscope/k8ssource/agenttype/infravalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions