Commit Graph

7 Commits

Author SHA1 Message Date
rinpatch d4fbec62a3 ReverseProxy: Fix a gun connection leak when there is an error with no
body

- Modify `close/1` function to do the same thing it does for hackney,
which is - close the client rather than the whole connection
- Release the connection when there is no body to chunk
2020-07-26 19:30:17 +03:00
rinpatch 58a4f350a8 Refactor gun pooling and simplify adapter option insertion
This patch refactors gun pooling to use Elixir process registry and
simplifies adapter option insertion.

Having the pool use process registry instead of a GenServer has a number of advantages:
- Simpler code: the initial implementation adds about half the lines of code it deletes
- Concurrency: unlike a GenServer, ETS-based registry can handle multiple checkout/checkin
requests at the same time
- Precise and easy idle connection clousure: current proposal for closing idle connections in
the GenServer-based pool needs to filter through all connections once a minute and compare their
last active time with closing time. With Elixir process registry this can be done
by just using `Process.send_after`/`Process.cancel_timer` in the worker process.
- Lower memory footprint: In my tests `gun-memory-leak` branch uses about 290mb on peak load (250 connections)
and 235mb on idle (5-10 connections). Registry-based pool uses 210mb on idle and 240mb on peak load
2020-07-15 15:17:27 +03:00
Alexander Strizhakov 98ed0d1c4b
more clean up 2020-03-13 09:37:57 +03:00
Mark Felder d9c5ae7c09 Update Copyrights for gun related files 2020-03-03 17:16:24 -06:00
Alexander Strizhakov d0e4d3ca3b
removing unnecessary with
comment in tesla client impovement
2020-03-03 14:56:49 +03:00
Alexander Strizhakov 151dc4e387 Apply suggestion to lib/pleroma/reverse_proxy/client/tesla.ex 2020-03-03 09:53:37 +00:00
Alexander Strizhakov 514c899275
adding gun adapter 2020-02-18 08:19:01 +03:00