This gist contains a Docker Compose configuration, including a simple FastAPI service,
and a container with tcping
installed, which triggers TCP connections to the service.
To speed up the memory leak reproduction, the tcping
container can be scaled up using
docker-compose
scaling capabilities.
- Download the entire content of this gist to a folder.
- Run
docker-compose up --build --scale tcping=N
(e.g. N=10). - On a separate terminal, run
docker stats
and check memory usage on the API service container. - To stop, just Ctrl+C on the terminal where
docker-compose
is running.
The Docker Compose configuration allows for Uvicorn changes to be tested locally.
- Clone Uvicorn in a subfolder:
git clone git@github.com:encode/uvicorn.git
- Uncomment the
volumes
section in thedocker-compose.yml
file. - Make changes to the cloned Uvicorn repository. For example, apply the changes from encode/uvicorn#1192.
- Run the Docker Compose configuration, following the previous steps.