b7417e1a6958179e105f07404cb2468753c6faf6
The code behind plan §7.3-7.6: - breaker: folds cooldown and circuit breaking into one component (FailureThreshold=1 gives LiteLLM-style cooldown), with exponential backoff and half-open probes. - endpoint: live state registry. Inflight counting, staleness detection, drain rate derived from counters. A scrape failure does not trip the breaker — the engine may be serving fine while only its metrics endpoint is down. - scrape: parses the §7.6 metric contract. Errors when any of the mandatory three is missing; the metric name mapping is overridable, since names drift between versions (plan §14). - scheduler: the filter -> score -> pick pipeline. A "strategy" is now just a set of scorer weights; chat, batch and long-context are the same code with different weights. Scorers: queue, kv (hard penalty above the ceiling), inflight, load, weight, session (bounded-load consistent hashing). Pickers: max-score, p2c, softmax, round-robin. Decision carries the rationale — which scorer produced what, which filter dropped how many. Tuning the weights without that is guesswork. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
llmgw
Çoklu InfiniBand fabric ve heterojen GPU için tek binary LLM gateway.
Kendi GPU sunucularında çalışan LLM'leri (vLLM / SGLang) tek bir OpenAI uyumlu uç noktadan sunar. Tasarım dokümanı: llmgw-plan.md.
Durum
| Faz | Kapsam | Durum |
|---|---|---|
| 0 | İskelet + sim-engine | ✅ |
| 1 | Statik router (filter/score/pick, streaming proxy) | ⬜ |
| 1.5 | Admission control (öncelik bantları) | ⬜ |
| 2 | Agent: GPU/IB keşfi, tek-node engine | ⬜ |
| 3 | Control plane: katalog, scheduler, reconciler | ⬜ |
| 4 | Multi-node & fabric farkındalığı | ⬜ |
| 5 | Tenancy, prefix affinity, bench | ⬜ |
Kurulum
make build # bin/llmgw
make test # birim testleri
make race # yarış dedektörüyle
sim-engine
Gerçek bir inference engine'in router açısından önemli davranışlarını simüle eder; GPU olmadan geliştirme ve test yapabilmek için. Modellediği şeyler:
- continuous batching (sınırlı eşzamanlı dizi sayısı)
- KV cache blok muhasebesi; blok yetmediğinde kuyruğa alma (head-of-line blocking dahil)
- otomatik prefix cache (zincirlenmiş blok hash'leri + LRU) ve cache hit'in TTFT'ye etkisi
- batch büyüdükçe token başına gecikmenin artması
- istemci koptuğunda isteğin batch'ten düşürülüp blokların bırakılması
- vLLM metrik adlarıyla
/metrics
./bin/llmgw sim-engine --listen :8000 --model llama-3.3-70b
curl -N localhost:8000/v1/chat/completions \
-H 'content-type: application/json' \
-d '{"messages":[{"role":"user","content":"merhaba"}],"max_tokens":8,"stream":true}'
Yük/gecikme davranışını ayarlamak için: --max-num-seqs, --num-gpu-blocks,
--prefill-tps, --decode-tps, --batch-contention, --prefix-cache-blocks.
Kaos testleri için: --fail-rate, deterministik koşu için --seed.
Engine metrik kontratı
Router'ın yönlendirme yapabilmesi için bir engine'in vermesi zorunlu üç metrik (plan §7.6). sim-engine bunları gerçek vLLM adlarıyla yayınlar:
vllm:num_requests_running
vllm:num_requests_waiting
vllm:kv_cache_usage_perc
Modül yolu
gitea.mynodes.xyz/ilker/llmgw. Değiştirmek için:
make rename NEW=git.ornek.com/ekip/llmgw