monitorEventLoopDelay 是什么


  • options: Object
    resolution: The sampling rate in milliseconds. Must be greater than zero. Default: 10.
  • Returns: Histogram

    Creates a Histogram object that samples and reports the event loop delay over time. The delays will be reported in nanoseconds.
    Using a timer to detect approximate event loop delay works because the execution of timers is tied specifically to the lifecycle of the libuv event loop. That is, a delay in the loop will cause a delay in the execution of the timer, and those delays are specifically what this API is intended to detect.

监控 EventLoop 运行情况是判断系统是否健康的重要指标之一,如果有大量的延迟,说明系统存在密集计算,降低了系统的吞吐。Node.js 在 v11 版本引入了monitorEventLoopDelay,而之前需要自己去实现。

Read More

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now