7.7.1 · блок 7
Сравнение и выбор serving-стека
Сравнение и выбор serving-стека
Зачем это нужно
Модуль 7 представил MLServer, Seldon, Triton, KServe, vLLM — легко переусложнить или выбрать GPU server для sklearn. Этот урок — decision guide с таблицами сценариев для capstone, exam и реальной работы: orchestrator + runtime под задачу.
Основные идеи
Две оси выбора.
1. Orchestrator — кто создаёт K8s ресурсы, canary, storage init: plain K8s, Seldon, KServe.
2. Runtime — кто выполняет infer: MLServer, Triton, vLLM, custom.
Рекомендация MDP: KServe + runtime по типу модели.
Сравнение orchestrators.
| Критерий | Plain Deployment | Seldon Core | KServe |
|----------|------------------|-------------|--------|
| Learning curve | Низкая | Средняя | Средняя |
| Canary / traffic split | DIY (Istio) | Built-in | Built-in |
| Model storage init | DIY | Supported | storage-initializer |
| LLM ecosystem | DIY | Слабее | Сильнее |
| Graph pipelines | Manual | Rich | Transformer + limited |
| Platform standard MDP | Dev only | Legacy | **Preferred** |
KServe — CNCF project, а не «индустриальный стандарт»: выбор зависит от требований платформы, модели, команды и уже установленного стека.
Сравнение runtimes.
| Критерий | MLServer | Triton | vLLM |
|----------|----------|--------|------|
| sklearn/LGBM/XGB | ★★★★★ | ★★★ | ✗ |
| ONNX CPU | ★★★★ | ★★★★★ | ✗ |
| GPU DL / CV | ★★ | ★★★★★ | ★★★ |
| LLM generative | ✗ | ★★★ (TRT-LLM) | ★★★★★ |
| Dynamic batching | Basic | Advanced | Continuous (LLM) |
| Ops complexity | Low | High | High |
Сценарии выбора (главная таблица курса).
| Сценарий | Orchestrator | Runtime | Комментарий |
|----------|--------------|---------|-------------|
| Tabular online < 500 ms, CPU | KServe | MLServer sklearn | Capstone default |
| Tabular + heavy custom preprocess | KServe | MLServer + transformer | Feast lookup in transformer |
| High RPS ONNX on GPU | KServe | Triton | Dynamic batching |
| Multi-model one GPU | KServe | Triton repo | Several models in one IS |
| Legacy enterprise graphs | Seldon | MLServer/Triton mix | Migration to KServe later |
| Llama / chat instruct | KServe | vLLM custom | OpenAI API at gateway |
| VLM image+text | KServe | vLLM + transformer | Presigned URLs for images |
| Nightly batch 100M rows | Argo + Spark | Spark MLlib / export scores | **Not** KServe |
| Teaching / debug local | Docker | MLServer | Before K8s |
| Edge mobile | — | ONNX Runtime Mobile | Outside cluster |
Anti-patterns.
- Triton + GPU для tiny sklearn — ops tax без выигрыша.
- Flask pickle in prod — no protocol, no probes standard.
- vLLM для tabular — wrong tool.
- Seldon и KServe на один сервис — pick one.
Decision flowchart (text).
Online inference?
No → Spark / batch job
Yes → LLM generative?
Yes → KServe + vLLM (+ gateway)
No → GPU needed?
Yes → KServe + Triton
No → KServe + MLServer
Need complex multi-node graph?
Yes → Seldon or KServe transformer chain
No → KServe simple predictor
Non-functional checklist.
- p95 latency target?
- RPS peak?
- Model size / GPU VRAM?
- Canary required?
- Team knows the stack?
Как это выглядит на практике
Capstone «Churn scoring». KServe + MLServer + optional Feast transformer — row 1 таблицы.
Stretch «Product image caption». KServe + vLLM multimodal — row 6.
Platform team. Maintains ClusterServingRuntime catalog; teams fill ADR template (link 6.4.3 style) if requesting new runtime.
Exam-style question. «Fraud scoring 5k RPS, 50 ms p95, XGBoost 2 MB» → KServe + MLServer (CPU), HPA, maybe ONNX+Triton only if profiling shows CPU bottleneck.
Что сделать после занятия
- [ ] Заполните таблицу сценариев для вашего capstone (orchestrator + runtime + почему).
- [ ] Пройдите decision flowchart для 2 hypothetical cases от одногруппника.
- [ ] Напишите один anti-pattern, который вы almost выбрали бы по незнанию.