-
-
Notifications
You must be signed in to change notification settings - Fork 7
Description
While running the test instance at extracker.dahrkael.net:6969 I noticed memory usage while not crazy (~3GB) was way higher than what was actually needed to store the actual data (~300MB for ~100k peers and ~100k swarms).
Investigating the matter I found out the default allocator strategy for ETS tables is not great for this use case (lots of tables with lots of changing records).
One easy solution is changing the strategy at startup from Address order first fit carrier best fit to either Address order best fit or Best fit.
When running through iex, just need to append --erl "+MEas aobf". This cuts down memory usage from ~3GB to ~500MB.
Relevant links about this:
https://www.erlang.org/doc/apps/erts/erts_alloc.html
https://erlang.org/pipermail/erlang-questions/2017-April/092056.html
https://stackoverflow.com/questions/49847782/erlang-ets-memory-fragmentation
This is something to take into account when the day of generating releases and docker images arrives.