Skip to content

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

Merged
dan-petty merged 2 commits into
mainfrom
perf/3518-embed-threads
Nov 4, 2026
Merged

dan-petty merged 2 commits into
mainfrom
perf/3518-embed-threads

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

An embedding-only tier sets LLAMA_ARG_THREADS: "1". The embedder runs on the GPU, and the default threads of llama-server only spin: 12 CPU cores for each instance under load, against 1.2 with one thread, at the same speed and with exactly equal vectors.

The gateway keeps simple-shuffle for embeddings. Under least-busy, every batch went to the first deployment. The gateway comment records this, so nobody makes that change again without a new measure.

Closes #3518

Change: openspec/changes/archive/2026-11-04-3518-embed-threads/

@dan-petty dan-petty added type/infra Type infra: the build, CI, images or cluster scope/k8s Kubernetes commands, Helm charts, pods, services, and policies labels Nov 4, 2026
@dan-petty

Copy link
Copy Markdown
Owner Author

Evidence

Measured in-cluster on ollama/ollama:0.40.12 with temporary pods. CPU is from the cgroup cpu.stat. Batch: 32 chunks of about 300 tokens.

num_thread Median 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: 1.69 s, 2.0 core-seconds, 1.2 cores, 100% GPU. Vectors for 34 inputs with num_thread 1 and the default are exactly equal. num_thread as a request option reloads the model (4.3 s), so the variable is on the tier.

Routing, 3 rounds, 24 batches for each cell, same image as the gateway, batches a second:

Streams Ideal client balance simple-shuffle least-busy Gateway (control)
2 1.10 0.85 0.58 0.88
4 1.10 0.93 0.54 0.93
8 1.12 1.08 0.56 0.99

least-busy sent 72 of 72 batches to gpu0 in each row.

Merge Danger

Door: two-way. Revert the commit and render.

Blast Radius: restart. On merge, Argo CD restarts both embedding instances and rolls the gateway, because the gateway config comment changes. A batch that is in flight can fail, and the fallback tiers take the next batches.

Local run

uv run devops ci on the final tree: 18,280 tests passed and 2 failed. Both failures also occur on origin/main and #3025 records them. coverage did not run because of them. The test check took 8m 34s in this run, against 4m 50s and 5m 13s in two earlier runs today, with other work on the same machine.

After the merge, a person confirms that both pods are Ready, and that kubectl top pod -n llm shows about 1 core for each instance under load.

@dan-petty
dan-petty marked this pull request as ready for review November 4, 2026 21:37
@dan-petty
dan-petty merged commit c196a54 into main Nov 4, 2026
19 checks passed
@dan-petty
dan-petty deleted the perf/3518-embed-threads branch November 4, 2026 21:38
dan-petty-release Bot added a commit that referenced this pull request Nov 4, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.56.1](v0.56.0...v0.56.1)
(2026-11-04)


### Bug Fixes

* **roadmap:** the App token can push a workflow file
([#3521](#3521))
([835fbac](835fbac))


### Performance Improvements

* **ci:** run the test row in four shards on four runners
([#3517](#3517))
([69ee7da](69ee7da))
* **k8s:** embedding-only tiers use one CPU thread
([#3522](#3522))
([c196a54](c196a54)),
closes [#3518](#3518)

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/k8s Kubernetes commands, Helm charts, pods, services, and policies type/infra Type infra: the build, CI, images or cluster

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant