[erlang-questions] mochiglobal vs ets vs registered process

Garrett Smith <>
Tue May 22 21:15:32 CEST 2012


On Tue, May 22, 2012 at 2:06 PM, Bob Ippolito <> wrote:
>
> On Tue, May 22, 2012 at 11:55 AM, Tomasz Maciejewski <>
> wrote:
>>
>> Dnia 22-05-2012 o 20:39:23 Garrett Smith <> napisał(a):
>>
>>> The test was to simply read a "global" value 1M times, after having
>>> first initialized the facility. Times are of the "run" portion only
>>> and do not include the "init" time.
>>
>> I see your test reading 1M times *the same* value. I'd rather see the test
>> when you write and read 1M random keys/values. The single value could be
>> cached spoiling the test.
>
> mochiglobal is unsuitable for writes at runtime, at least prior to R16,
> because loading new code blocks the whole VM (possibly for *seconds*). The
> (only) occasion where you'll see mochiglobal work better than ets is when
> you have a very large data structure that you need to read at runtime with
> high process concurrency. The goal is to share memory and avoid garbage
> collector churn. In the tests the given value is so small AND you're only
> reading it from one process, so of course that there's no benefit.

This is good to know.

I included mochiglobal in the tests because it was suggested in the
prior thread as a possible approach. In this use case, the values are
quite small.

Garrett



More information about the erlang-questions mailing list