[erlang-questions] ets:update_counter/3 optimal settings

Sverker Eriksson sverker.eriksson@REDACTED
Mon Jun 19 18:05:37 CEST 2017


Table option {write_concurrency, true} can only reduce lock contention
when you got concurrent write operations toward *different* keys
within the same table.

Write operations towards one specific table object is always serialized
with locking.


/Sverker, Erlang/OTP


On 06/09/2017 07:44 AM, Frank Muller wrote:
> Hi Everyone,
>
> I've some troubles to understand the optimal settings for this little
> simple problem:
>
> Two Erlang processes A and B.
>
> 1. Process A randomly increments a counter during its lifetime using "ets
> :update_counter/3"
>
> 2. Process B reads the counter every X seconds and reset it to 0.
>
> I decided to use these options when creating the table:
>
> {write_concurrency, true}, %% A and B
> {read_concurrency, false}  %% only B
>
> Are these settings correct and more importantly "optimal" (please elaborate
> your answer)?
>
> /Frank
>
>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20170619/d011927b/attachment.htm>


More information about the erlang-questions mailing list