You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found that router image memory utilization will steadily go up by running long stability tests. The test is performed using RoundRobin strategy thus no HashTrie and HashTrie nodes are created.
To Reproduce
Deploy the router image on EKS connecting to a bunch of existing model servers, use the round robin routing strategy
Enable the EKS container insights thus we can check the pod memory utilization
Start the long-running benchmark test against the router image endpoint. Currently our test traffic is very predictable and steady. E.g 100 concurrent request. And every user will ask 5 questions. The input context is selected from a fixed pool.
Check the memory usage of the route pod. You will identify the steady trend of memory usage going up
Expected behavior
The memory usage should go up and down. The usage should be around a baseline per testing.
I have also experience this issue in my production environment
The production-stack router (vllm-router) shows a slow but steady memory leak: RSS grows roughly linearly over time and never plateaus, independent of request volume. Two independent router replicas serving the same traffic grow at an identical rate, which points to the router process itself rather than the environment.
Growth is slow (~12 MiB/day) so it isn't urgent, but with no memory limit it continues unbounded until the pod is restarted, and over weeks it becomes significant.
Environment
Router: vLLM production-stack router (vllm-router), running in Kubernetes
Python 3.12, aiohttp-based, served via uvicorn/FastAPI
--routing-logic roundrobin
--engine-stats-interval 15
--request-stats-window 60
2 router replicas, 2 backend vLLM pods
Backends: 4× Qwen3-4B, K8s pod-ip service discovery
Container memory limit 1000Mi in normal operation (removed during profiling so RSS
wasn't OOM-killed mid-capture)
RSS climbs ~[FILL: X] MiB/day, linear, identical on both replicas, no restart.
Method
memray attach to the router process (PID 1) for ~3 days under normal traffic, then
detached and analysed off-pod.
Key finding
Total memory allocated: 130.8 GB (cumulative over 3 days)
Peak memory usage: 56.7 MB (flat for the whole capture)
Total allocations: 57.3 M
Peak live memory stayed at ~57 MB the entire time. A genuine object leak would
show live memory tracking the RSS climb — it doesn't. The 130 GB is churn (allocated
then freed), not retention.
Where the churn comes from
Top allocators by cumulative size:
json.raw_decode + json.loads → ~76 GB
prometheus_client text parsing (text_string_to_metric_families) → ~13 GB
By module: vllm_router 79.8 GB, prometheus_client 21.9 GB
These sit on the engine-stats scrape path
(_scrape_worker → _scrape_one_endpoint → from_vllm_scrape → text_string_to_metric_families)
and the /metrics exposition (generate_latest → sample_line), plus per-request
JSON handling on the chat route.
Why RSS still grows
memray flamegraph --leaks flagged it directly:
generated with the pymalloc allocator active... the allocator retains memory in
memory pools even after the objects are deallocated, and Memray won't be able to
distinguish memory set aside for reuse from leaked memory.
So the memory is freed at the app level but retained by the allocators (pymalloc
pools + glibc per-thread arenas) under very high scrape/parse churn — classic
fragmentation signature, not a reference leak.
Activity
babu97 commentedon Oct 23, 2026
I have also experience this issue in my production environment
The production-stack router (vllm-router) shows a slow but steady memory leak: RSS grows roughly linearly over time and never plateaus, independent of request volume. Two independent router replicas serving the same traffic grow at an identical rate, which points to the router process itself rather than the environment.
Growth is slow (~12 MiB/day) so it isn't urgent, but with no memory limit it continues unbounded until the pod is restarted, and over weeks it becomes significant.
Environment
Router: vLLM production-stack router (vllm-router), running in Kubernetes
Python 3.12, aiohttp-based, served via uvicorn/FastAPI
--routing-logic roundrobin
--engine-stats-interval 15
--request-stats-window 60
2 router replicas, 2 backend vLLM pods
babu97 commentedon Oct 29, 2026
Profiled it with memray for over ~3 days and the results narrow down the cause
Setup (reproducible)
lmcache/lmstack-router@sha256:7a23717da4742ca327f65d5621a6bb3212c7ee69d2feea780d7a1ae7eaec7717--routing-logic roundrobin --engine-stats-interval 15 --request-stats-window 60wasn't OOM-killed mid-capture)
Method
memray attachto the router process (PID 1) for ~3 days under normal traffic, thendetached and analysed off-pod.
Key finding
Total memory allocated: 130.8 GB (cumulative over 3 days)
Peak memory usage: 56.7 MB (flat for the whole capture)
Total allocations: 57.3 M
Peak live memory stayed at ~57 MB the entire time. A genuine object leak would
show live memory tracking the RSS climb — it doesn't. The 130 GB is churn (allocated
then freed), not retention.
Where the churn comes from
Top allocators by cumulative size:
json.raw_decode+json.loads→ ~76 GBprometheus_clienttext parsing (text_string_to_metric_families) → ~13 GBvllm_router79.8 GB,prometheus_client21.9 GBThese sit on the engine-stats scrape path
(
_scrape_worker → _scrape_one_endpoint → from_vllm_scrape → text_string_to_metric_families)and the
/metricsexposition (generate_latest → sample_line), plus per-requestJSON handling on the chat route.
Why RSS still grows
memray flamegraph --leaksflagged it directly:So the memory is freed at the app level but retained by the allocators (pymalloc
pools + glibc per-thread arenas) under very high scrape/parse churn — classic
fragmentation signature, not a reference leak.
Mitigation (testing)
Capping glibc arenas on the router:
Possible upstream improvements
MALLOC_ARENA_MAXguidance for the router (or ship jemalloc in the image).--engine-stats-intervaland theprometheus text-parse cost are the levers for reducing churn.