actix-web: HTTP2 memory leak with many concurrent streams
Take the static_index
example from https://github.com/actix/examples
cd static_index
cargo run --release 2>/dev/null
And then run h2load -n 1000000 -c 10 -m 200000 http://127.0.0.1:8080/
When the benchmark is done, memory stays used in the server.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 30 (8 by maintainers)
Taking a quick look at this is seems that the issue you’re seeing here is twofold:
h2load
finishes a lot of memory is simply lost to fragmentation. If you switch to jemalloc your memory usage will drop by a lot.actix-web
itself where even after the test finishes its internal structures (which were previously bloated due to a massive amount of requests) are not shrunk back to their normal size. I’ve attached a flamegraph (courtesy of my memory-profiler; GitHub unfortunately doesn’t allow attaching raw svg so I had to gzip it - just unpack it and open in your web browser) where you can see around ~140MB that was kept allocated long afterh2load
finished.valgrind:
full: https://gist.github.com/leo-lb/8ec427c3978e74eea78423c6ea514a9b narrow biggest: https://gist.github.com/leo-lb/86856462eecab9b3a106b874c3322567
@0xpr03