How to organize parallel access to data (e.g. ETS table) from bunch of processes in erlang or elixir?
In traditional model I would create RWLock
and make critical section as small as possible. So, I can access to hash-table with parallel reads at least.
In erlang first idea is implement gen_server
that store table in state. But all access will be serialized. How to handle it to serve faster?
Use direct access to :ets
and specify read_concurrency: true
in call to :ets.new/2
.
GenServer
is a redundant link here, that might become a bottleneck.