1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] After load test, should memory return to baseline or stabilize higher? How to tell...

Discussão em 'Python' iniciado por Stack, Setembro 17, 2025.

  1. Stack

    Stack Membro Participativo

    I’m trying to understand the expected memory behavior of a Python service (FastAPI in my case, but the question is more general).

    Scenario:

    Baseline memory: service starts around ~600 MB.

    During load: memory usage rises significantly (e.g., 1 GB+ under heavy requests).

    After load ends: memory doesn’t return to baseline. Instead, it stabilizes at a higher level (say ~900 MB) and stays there.

    My questions are:


    1. Should memory return all the way back to the baseline once the load is gone, or is it normal for it to stabilize at a higher “working set” because of Python’s allocator, pools, or library caches?


    2. If I run a second load test at the same traffic level, should memory rise further, or will it reuse what was already allocated?


    3. How do I distinguish normal plateau behavior from an actual memory leak? For example:

    Case 1: Memory rises under load, then flattens at a higher level than baseline and remains stable → is this normal?

    Case 2: Memory rises under load and keeps growing even after load ends, or drifts upward across test cycles → is this a leak?

    Please note it's Python 3.10.x version,fastapi based microservice dockerized and running on kubernetes pod. Looking for guidance on what “healthy” memory usage looks like in Python services, and how to tell when to worry.

    Thanks!

    Continue reading...

Compartilhe esta Página