Skip to content

Commit f45390b

Browse files
Csrayzhmellor
authored andcommitted
[Frontend] Expose do_log_stats interval to env (vllm-project#22905)
Signed-off-by: Csrayz <jover@cmbchina.com> Co-authored-by: Harry Mellor <19981378+hmellor@users.noreply.github.com> Signed-off-by: Xiao Yu <xiao.yu@amd.com>
1 parent 1666f7f commit f45390b

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

docs/usage/troubleshooting.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ You can check if this is happening by trying the old defaults with `--generation
3535
If other strategies don't solve the problem, it's likely that the vLLM instance is stuck somewhere. You can use the following environment variables to help debug the issue:
3636

3737
- `export VLLM_LOGGING_LEVEL=DEBUG` to turn on more logging.
38+
- `export VLLM_LOG_STATS_INTERVAL=1.` to get log statistics more frequently for tracking running queue, waiting queue and cache hit states.
3839
- `export CUDA_LAUNCH_BLOCKING=1` to identify which CUDA kernel is causing the problem.
3940
- `export NCCL_DEBUG=TRACE` to turn on more logging for NCCL.
4041
- `export VLLM_TRACE_FUNCTION=1` to record all function calls for inspection in the log files to tell which function crashes or hangs. Do not use this flag unless absolutely needed for debugging, it will cause significant delays in startup time.

vllm/entrypoints/openai/api_server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ async def lifespan(app: FastAPI):
126126

127127
async def _force_log():
128128
while True:
129-
await asyncio.sleep(10.)
129+
await asyncio.sleep(envs.VLLM_LOG_STATS_INTERVAL)
130130
await engine_client.do_log_stats()
131131

132132
task = asyncio.create_task(_force_log())

vllm/envs.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
VLLM_LOGGING_PREFIX: str = ""
3939
VLLM_LOGGING_CONFIG_PATH: Optional[str] = None
4040
VLLM_LOGITS_PROCESSOR_THREADS: Optional[int] = None
41+
VLLM_LOG_STATS_INTERVAL: float = 10.
4142
VLLM_TRACE_FUNCTION: int = 0
4243
VLLM_ATTENTION_BACKEND: Optional[str] = None
4344
VLLM_USE_FLASHINFER_SAMPLER: Optional[bool] = None
@@ -436,6 +437,12 @@ def get_vllm_port() -> Optional[int]:
436437
lambda: int(os.getenv("VLLM_LOGITS_PROCESSOR_THREADS", "0"))
437438
if "VLLM_LOGITS_PROCESSOR_THREADS" in os.environ else None,
438439

440+
# If set, vllm will log stats at this interval in seconds
441+
# If not set, vllm will log stats every 10 seconds.
442+
"VLLM_LOG_STATS_INTERVAL":
443+
lambda: val if (val := float(os.getenv("VLLM_LOG_STATS_INTERVAL", "10.")))
444+
> 0. else 10.,
445+
439446
# Trace function calls
440447
# If set to 1, vllm will trace function calls
441448
# Useful for debugging

0 commit comments

Comments
 (0)