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

Frank Muller frank.muller.erl@REDACTED
Fri Jun 9 08:25:18 CEST 2017


Hi Alex,

Thanks for the tip.
Anything else I should be aware of?

/Frank

Le ven. 9 juin 2017 à 08:08, Alex S. <alex0player@REDACTED> a écrit :

> Sounds right to me, with the caveat that read + reset to zero can lose
> some data if you are preempted between those two calls. My usual approach
> is read and decrement by -N, where N is the value I just read.
>
> 9 июня 2017 г., в 8:44, Frank Muller <frank.muller.erl@REDACTED>
> написал(а):
>
> 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/20170609/2dea5642/attachment.htm>


More information about the erlang-questions mailing list