[erlang-questions] Measuring message queue delay

Robert Raschke rtrlists@REDACTED
Wed Apr 29 13:24:49 CEST 2015


Hi Roger,

maybe you can use the tracing facilities of Erlang. At a low level it is
reasonably easy to use erlang: trace/3 with options
[send,'receive',timestamp] and get all messages from designated processes
with timestamps sent to a "tracer" process. You can then do whatever
analysis you need on that.

Best regards,
Robby
 On Apr 29, 2015 10:12 AM, "Roger Lipscombe" <roger@REDACTED> wrote:

> For various reasons, I want a metric that measures how long messages
> spend in a process message queue. The process is a gen_server, if that
> has any bearing on the solution. Also, this is for production, so it
> will be always-on and must be low-impact.
>
> I could do this by timestamping _every_ message sent to the process
> and then reporting the deltas, but I think that's ugly.
>
> I thought of posting a message to self(), with a timestamp and then
> measuring the delta. I could then post another one as soon as that
> message is processed. Obviously, this leaves the process continually
> looping, which is not good.
>
> So, instead, I could use erlang:send_after, but that requires two
> messages: a delayed one triggered by erlang:send_after, and an
> immediate one for measuring the delay.
>
> That's a bit complicated.
>
> Would it be sensible to send a message, with erlang:send_after, with
> the _expected_ timestamp, and then compute the delta from that?
>
> Or, alternatively, what other ways could I measure how long a process
> is taking to handle its message queue?
>
> Thanks,
> Roger.
> _______________________________________________
> 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/20150429/ec1ed16e/attachment.htm>


More information about the erlang-questions mailing list