[erlang-questions] BEAM performance?

Jesper Louis Andersen jesper.louis.andersen@REDACTED
Wed May 24 15:19:38 CEST 2017


On Wed, May 24, 2017 at 3:02 PM Oliver Korpilla <Oliver.Korpilla@REDACTED>
wrote:

>
> * Are there mechanisms internal to BEAM impacting this? Or is it purely a
> property of the CPU architecture?
>

If you experience latencies in the millisecond range, I don't think you are
looking at a CPU caching problem. A DRAM hit is 300ns or 0.3us. So you'd
need about 3000 of those to hit 1ms run time. The napkin math doesn't
really pan out too well.

Do you run the ERTS in embedded mode[0]? I'd look at code loading. Or
perhaps ASN.1 loading initially if it compiles stuff the first time around.

As for the two DB writes to the same row in short order: Mnesia uses an
optimistic locking strategy. If two transactions write to the same row at
the same time, both will aborted, wait a bit and try again. If you're
unlucky, those two writes will keep interfering with each other and you
will get lag. A good way around this is a design which serializes such
writes. Or perhaps you can make the write dirty (this can actually be safe
in some situations, depending on your setup).

[0]
http://erlang.org/doc/system_principles/system_principles.html#code_loading
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20170524/fb535050/attachment.htm>


More information about the erlang-questions mailing list