[erlang-questions] LCNT: understanding proc_* and db_hash_slot collisions

Lukas Larsson garazdawi@REDACTED
Mon Aug 1 01:45:56 CEST 2016


On Sun, Jul 31, 2016 at 2:37 PM, Max Lapshin <max.lapshin@REDACTED> wrote:

> Very nice, so it seems that our measuring
> process_info(Pid,message_queue_len) is really expensive?
>
>
On Sun, Jul 31, 2016 at 2:38 PM, Max Lapshin <max.lapshin@REDACTED> wrote:

> We can do it (measure message_queue_len) about 200 000 times per second.
> It is bad practice?
>

As always, it depends. The locks are on a per process basis, so what you
want to avoid is having the message queue length of one process being read
very frequently by multiple other processes.

When the conflicts happen some extra work has to be done by the process
which is being inspected, but perhaps most notably the process doing the
inspection gets suspended until it can get the locks it needs. The CPU
usage of the conflict handing is not very large, but the suspension of the
inspector could cause noticeably higher latency, especially if there are a
lot of processes being suspended because they need the same lock.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20160801/2391e421/attachment.htm>


More information about the erlang-questions mailing list