Skip to content

Commit b59bbce

Browse files
authored
Merge branch 'master' into feature/valkey-store-backend
2 parents 58d1709 + 06b4a29 commit b59bbce

2 files changed

Lines changed: 41 additions & 5 deletions

File tree

backend/python/sglang/backend.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,14 @@ def _messages_to_dicts(self, messages) -> List[dict]:
173173
def Health(self, request, context):
174174
return backend_pb2.Reply(message=bytes("OK", 'utf-8'))
175175

176+
177+
def Status(self, request, context):
178+
# Minimal shim: LocalAI polls /backend.Backend/Status on registered
179+
# backends; without this method the default NotImplementedError from
180+
# backend_pb2_grpc bubbles up as HTTP 500 on /backend/monitor and blocks
181+
# inference requests to a healthy loaded model. Returning READY
182+
# unconditionally mirrors the existing Health method's behavior.
183+
return backend_pb2.StatusResponse(state=backend_pb2.StatusResponse.State.READY)
176184
async def LoadModel(self, request, context):
177185
model_ref, local_only = resolve_model_reference(request)
178186
engine_kwargs = {"model_path": model_ref}

docs/content/advanced/model-configuration.md

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -914,12 +914,40 @@ Define pipelines for audio-to-audio processing and the [Realtime API]({{%relref
914914

915915
## gRPC Configuration
916916

917-
Backend gRPC communication settings:
917+
Backend gRPC communication settings. These control the readiness handshake
918+
between LocalAI and a freshly spawned backend process — LocalAI polls the
919+
backend's `Health` gRPC method up to `grpc.attempts` times, sleeping
920+
`grpc.attempts_sleep_time` seconds between polls, before giving up and
921+
terminating the backend as unresponsive.
918922

919-
| Field | Type | Description |
920-
|-------|------|-------------|
921-
| `grpc.attempts` | int | Number of retry attempts |
922-
| `grpc.attempts_sleep_time` | int | Sleep time between retries (seconds) |
923+
| Field | Type | Default | Description |
924+
|-------|------|---------|-------------|
925+
| `grpc.attempts` | int | 20 | Number of health-check attempts before the backend is killed as unresponsive |
926+
| `grpc.attempts_sleep_time` | int | 2 | Sleep time between health-check attempts (seconds) |
927+
928+
**Total load window ≈ `grpc.attempts × (grpc.attempts_sleep_time + per-call gRPC dial timeout)`.**
929+
The default of `20 × 2 s ≈ 40 s` is fine for typical backends but is too
930+
short for large models that need substantial time to become gRPC-ready
931+
after the process starts — for example NVFP4 / FP8 models whose shard
932+
loading and CUDA-graph capture can take several minutes, or slow storage
933+
backends. If the backend keeps getting killed while still legitimately
934+
loading (visible as `exitCode=120` + `rpc error: code = Canceled desc =
935+
context canceled` in the LocalAI log, while the backend's own stderr
936+
shows continued forward progress), raise these values.
937+
938+
Example configuration for a model that needs up to ~10 minutes to become
939+
gRPC-ready (large NVFP4 model, cold shard load + CUDA-graph capture):
940+
941+
```yaml
942+
grpc:
943+
attempts: 140
944+
attempts_sleep_time: 5
945+
```
946+
947+
This gives a ~700 s window while keeping health-check polling frequent
948+
enough to detect real backend crashes quickly. The values only affect
949+
the initial readiness handshake — inference-request timeouts and the
950+
watchdog are unchanged.
923951

924952
## Overrides
925953

0 commit comments

Comments
 (0)