add 1 million request memory leak tests for extreme scale validation

- Add test_memory_baseline_1m for router (1,000,000 requests)
- Add test_proxy_memory_baseline_1m for proxy (1,000,000 requests)
- Add clarifying comment: high-volume tests verify memory limit strictness
- These extreme scale tests help detect very gradual leaks (~1-2 KB per 1000 requests)
- Estimated runtime: router ~15-20 min, proxy ~50-60 min
- For manual execution only, not included in CI
- Run with: pytest tests/load_tests/test_*_memory_growth.py::test_*_1m -v
This commit is contained in:
Alexsander Hamir 2026-01-10 17:43:53 -08:00
parent d0444c7287
commit dadadf777d
2 changed files with 40 additions and 1 deletions

View file

@ -423,6 +423,7 @@ async def test_proxy_memory_baseline_30k(proxy_server, limit_memory):
# We're only supposed to make it here if we're in a good place, meaning the memory limit needs to be strict enough to catch any possible OOMs from the previous tests.
@pytest.mark.asyncio
@pytest.mark.limit_leaks(MEMORY_LIMIT)
@pytest.mark.no_parallel # Must run sequentially - measures process memory
@ -456,3 +457,21 @@ async def test_proxy_memory_baseline_500k(proxy_server, limit_memory):
pytest tests/load_tests/test_proxy_chat_completions_memory_growth.py::test_proxy_memory_baseline_500k -v
"""
await run_proxy_memory_baseline_test(500000, proxy_server, limit_memory)
@pytest.mark.asyncio
@pytest.mark.limit_leaks(MEMORY_LIMIT)
@pytest.mark.no_parallel # Must run sequentially - measures process memory
async def test_proxy_memory_baseline_1m(proxy_server, limit_memory):
"""
Memory baseline test with 1,000,000 requests to the proxy server.
Uses @pytest.mark.limit_leaks("40 MB") to enforce memory limit.
If test_proxy_memory_baseline_1k and test_proxy_memory_baseline_2k pass but this fails,
it's a clear sign of sequential/progressive memory growth.
NOTE: This test should be run INDIVIDUALLY, not with other tests in this file.
Running multiple tests together causes memory baseline drift, making it difficult
to accurately detect linear memory growth. Run with:
pytest tests/load_tests/test_proxy_chat_completions_memory_growth.py::test_proxy_memory_baseline_1m -v
"""
await run_proxy_memory_baseline_test(1000000, proxy_server, limit_memory)

View file

@ -138,6 +138,7 @@ async def test_memory_baseline_50k(test_router, limit_memory):
"""
await run_memory_baseline_test(50000, test_router, limit_memory)
# We're only supposed to make it here if we're in a good place, meaning the memory limit needs to be strict enough to catch any possible OOMs from the previous tests.
@pytest.mark.asyncio
@pytest.mark.limit_leaks(MEMORY_LIMIT)
@pytest.mark.no_parallel # Must run sequentially - measures process memory
@ -153,4 +154,23 @@ async def test_memory_baseline_500k(test_router, limit_memory):
to accurately detect linear memory growth. Run with:
pytest tests/load_tests/test_router_acompletion_memory_growth.py::test_memory_baseline_500k -v
"""
await run_memory_baseline_test(500000, test_router, limit_memory)
await run_memory_baseline_test(500000, test_router, limit_memory)
@pytest.mark.asyncio
@pytest.mark.limit_leaks(MEMORY_LIMIT)
@pytest.mark.no_parallel # Must run sequentially - measures process memory
async def test_memory_baseline_1m(test_router, limit_memory):
"""
Memory baseline test with 1,000,000 requests.
Uses @pytest.mark.limit_leaks("40 MB") to enforce memory limit.
If test_memory_baseline_1k and test_memory_baseline_2k pass but this fails,
it's a clear sign of sequential/progressive memory growth.
NOTE: This test should be run INDIVIDUALLY, not with other tests in this file.
Running multiple tests together causes memory baseline drift, making it difficult
to accurately detect linear memory growth. Run with:
pytest tests/load_tests/test_router_acompletion_memory_growth.py::test_memory_baseline_1m -v
"""
await run_memory_baseline_test(1000000, test_router, limit_memory)