ETS table with only counters

Eric Pailleau eric.pailleau@REDACTED
Wed Nov 25 07:31:18 CET 2020


Hi, 
What I understand is that atomicity will serialize any call to this function. If you have only calls to this function, I'm not sure locking scheme will have an impact. 
OTP team may give more clues on this. 
But if you want to be sure, benchmark? 
I'm curious with the results. 

Envoyé depuis mon mobile 

---- Frank Muller a écrit ----

>Hi Eric,
>
>Do you mean that “read_concurrency | write_concurrency” options don’t
>matter in my case ?
>
>My original question was how to set them for best performances.
>
>/Frank
>
>24 nov. 2020 22:21, Eric Pailleau <eric.pailleau@REDACTED> wrote :
>
>> Hi,
>>
>> Documentation says that operation is guaranteed to be atomic and isolated
>> <https://erlang.org/doc/man/ets.html#concurrency>.
>>
>> Envoyé depuis mon mobile
>>
>>
>> ---- Frank Muller a écrit ----
>>
>> Hi guys,
>>
>> I've a ETS (type of "set") which contains ONLY counters
>> (ets:update_counter/3).
>>
>> This table is heavily used and the counters get incremented and
>> decremented at different rates.
>>
>> Question: how should i set my table?
>> 1. both concurrency set to true:
>>     [ set
>>     , {read_concurrency, true}
>>     , {write_concurrency, true} ].
>>
>> 2. only read concurrency set to true:
>>     [ set
>>     , {read_concurrency, true}
>>     , {write_concurrency, false} ].
>>
>> 3. only write concurrency set to true:
>>     [ set
>>     , {read_concurrency, false}
>>     , {write_concurrency, true} ].
>>
>> Please explain why?
>>
>> /Frank
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20201125/ee2c80d4/attachment.htm>


More information about the erlang-questions mailing list