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
Describe the bug
The current implementation of the HTTP server relies on FastAPI using async handlers and uvicorn as ASGI server. The performance is blazing fast however there are certain issues when scaling the app, and moreover when the number of simultaneous requests increases.
More specifically the result of a significant number of simultaneous requests explodes the memory, thus introducing a memory leak which is handled by the OS by killing the main process. This can cause reliability issues when scaling to production.
Send parallel requests, with the tool of your choice. (wrk used at the moment with wrk -c 400 -t 400 http://localhost:5000/\?url\=https://upload.wikimedia.org/wikipedia/commons/thumb/2/2f/Google_2015_logo.svg/2560px-Google_2015_logo.svg.png --latency)
Analyze the memory usage
Depending on the machine, after some time the memory usage will explode and the FastAPI server will be killed by the OS. (some time in our case on 16GB is after ~30 requests).
Expected behavior
Response time increases.
Images
Any image, Google Logo is provided for example.
Describe the bug
The current implementation of the HTTP server relies on FastAPI using async handlers and
uvicorn
as ASGI server. The performance is blazing fast however there are certain issues when scaling the app, and moreover when the number of simultaneous requests increases.More specifically the result of a significant number of simultaneous requests explodes the memory, thus introducing a memory leak which is handled by the OS by killing the main process. This can cause reliability issues when scaling to production.
Issues: tiangolo/fastapi/1624, tiangolo/fastapi/4649 present the problem and in the evolved discussion in tiangolo/fastapi/4221 a possible solution is presented.
To Reproduce
Steps to reproduce the behavior:
rembg s
wrk
used at the moment withwrk -c 400 -t 400 http://localhost:5000/\?url\=https://upload.wikimedia.org/wikipedia/commons/thumb/2/2f/Google_2015_logo.svg/2560px-Google_2015_logo.svg.png --latency
)Expected behavior
Response time increases.
Images
Any image, Google Logo is provided for example.
OS Version:
Pop!_OS 22.04 LTS x86_64
Rembg version:
v2.0.24
The text was updated successfully, but these errors were encountered: