Elixir/Erlang并发状态访问

au9on6nz  于 2022-12-08  发布在  Erlang
关注(0)|答案(1)|浏览(140)

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?

eoigrqb6

eoigrqb61#

使用对:ets的直接访问,并在对:ets.new/2的调用中指定read_concurrency: true
GenServer在这里是冗余链路,它 * 可能 * 成为瓶颈。

相关问题