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?
1条答案
按热度按时间eoigrqb61#
使用对
:ets
的直接访问,并在对:ets.new/2
的调用中指定read_concurrency: true
。GenServer
在这里是冗余链路,它 * 可能 * 成为瓶颈。