Skip to content

Memory usage higher than expected #1

@Dahrkael

Description

@Dahrkael

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions