appcues / mojito

An easy-to-use Elixir HTTP client, built on the low-level Mint library.
https://hexdocs.pm/mojito/Mojito.html
MIT License
349 stars 34 forks source link

Force GC on pool workers after request completes #77

Closed gamache closed 3 years ago

gamache commented 3 years ago

It was reported in #76 that Mojito pool workers consumed uncollected memory while they were idle, which can become a problem on memory-constrained systems making requests with large responses. This PR forces garbage collection on each pool worker directly after a request completes. In live testing, this reduced the steady state RAM consumption from ~400MB to ~150MB when downloading a 15MB file repeatedly.

Low RAM usage is not a design goal of Mojito, but this seems like a useful improvement.

Closes #76.

andyleclair commented 3 years ago

Looks like something is up with Travis not being able to find the right release for elixir here

The command "wget https://repo.hex.pm/builds/elixir/v1.11-otp-20.zip" failed and exited with 8

gamache commented 3 years ago

Yeah, Mojito won't be on Travis for much longer.

hubertlepicki commented 3 years ago

I have tested this on the project that I've been having issues with originally and I confirm that this resolves the issue.