add 500k memory leak tests for comprehensive analysis

- Add test_memory_baseline_500k for router (500,000 requests)
- Add test_proxy_memory_baseline_500k for proxy (500,000 requests)
- These high-volume tests are designed for manual execution and deep memory leak analysis
- Not included in CI due to long runtime (~15-30 minutes each)
- Useful for detecting very gradual memory accumulation patterns
- Run individually with: pytest tests/load_tests/test_*_memory_growth.py::test_*_500k -v
This commit is contained in:
Alexsander Hamir 2026-01-10 17:23:49 -08:00
parent f0d5c0b1d1
commit e868a5702e
2 changed files with 34 additions and 0 deletions

View file

@ -439,3 +439,20 @@ async def test_proxy_memory_baseline_50k(proxy_server, limit_memory):
pytest tests/load_tests/test_proxy_chat_completions_memory_growth.py::test_proxy_memory_baseline_50k -v
"""
await run_proxy_memory_baseline_test(50000, 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_500k(proxy_server, limit_memory):
"""
Memory baseline test with 500,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_500k -v
"""
await run_proxy_memory_baseline_test(500000, proxy_server, limit_memory)

View file

@ -138,3 +138,20 @@ async def test_memory_baseline_50k(test_router, limit_memory):
pytest tests/load_tests/test_router_acompletion_memory_growth.py::test_memory_baseline_50k -v
"""
await run_memory_baseline_test(50000, 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_500k(test_router, limit_memory):
"""
Memory baseline test with 500,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_500k -v
"""
await run_memory_baseline_test(500000, test_router, limit_memory)