Skip to content

Using Datadog PProf mess up Event Loop Utilization metrics / Event Loop Idle Time metrics #433

Open

Description

@Hackatosh

Hello !

I'm trying to use Pyroscope Profiler on my NodeJS Server which is itself based on the Datadog library implementing PProf support on NodeJS.

Since enabling Pyroscope on my server, I noticed that the Event Loop Utilization has increased by a lot, especially during times where there is not a lot of user activity (like during the night it went from from 10-15% Event Loop Utilization to 50% !)

According to your documentation this is expected but I wonder if this is not actually a bug !

I opened an issue on libuv concerning this problem : libuv/libuv#5373

Apparently there is an option that could enable when using SIGPROF signal that can solve this problem of ELU increase : libuv/libuv#5373 (comment) using the option UV_LOOP_BLOCK_SIGNAL

This might also be a bug in libuv itself and how it computes event loop idle metrics but it's still unclear : libuv/libuv#5325

Do you think @datadog/pprof-node could use the option UV_LOOP_BLOCK_SIGNAL to mitigate / solve the problems ? 🙏

Activity

  1. szegedi commented on Nov 10, 2026

    @szegedi
    Collaborator

    This is rather deliberate as it allows us to take a sample every sampling interval even if the service is idle. It has several benefits – we have evidence that sampling happened (so we can detect and report an oversubscribed CPU if it doesn't happen), we can use it as a signal that processing returned to the event loop between two stretches of busy samples (we use this in detection and reporting of long-running callbacks), and finally (this is probably least significant) we can attribute residual CPU usages (usually few microseconds per 10ms) to the time periods they actually happened in, instead of rolling them up into the next non-idle sample.

    Yes, we could have an optional mode where we apply UV_LOOP_BLOCK_SIGNAL with uv_loop_configure, I actually considered it before. We'd keep the default as-is, though. I'm not sure when I'd have time to implement this, but I'd be open to reviewing a PR that adds it.

  2. Hackatosh commented on Nov 16, 2026

    @Hackatosh
    Author

    Hello !

    Thanks for answering ! I tried looking into UV_LOOP_BLOCK_SIGNAL but I'm worried this would break the CPU profiles of this library.

    I found this pull request nodejs/node#2324 that disables the option on NodeJS except when v8.log profiling is enabled with this comment :

      // Block SIGPROF signals when sleeping in epoll_wait/kevent/etc.  Avoids the
      // performance penalty of frequent EINTR wakeups when the profiler is running.
      // Only do this for v8.log profiling, as it breaks v8::CpuProfiler users.
      if (v8_is_profiling) {
        uv_loop_configure(uv_default_loop(), UV_LOOP_BLOCK_SIGNAL, SIGPROF);
      }
    

    (I mentionned it in the libuv issue : libuv/libuv#5325 (comment))

    What do you think ? 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions