14

My application is a web version of the board game Settlers of Catan.

I'm using node --prof app.js to profile the app and node --prof-process ISOLATE_LOG_FILE > processed.txt to turn them into a processed file.

I do get a lot of Code move event for unknown code events: https://prnt.sc/q69ugk

At the end I'm left with a file, like so:

Statistical profiling result from isolate-0x3df60c0-v8.log, (13113 ticks, 192 unaccounted, 0 excluded).

enter image description here

  1. What is this epoll_pwait in the context of node.js?
  2. Why is it using 60% of my application?
  3. What can I do about this?
Esqarrouth
  • 38,543
  • 21
  • 161
  • 168
  • did you work this one out? I'm facing the same question... I too have a very high `epoll_pwait` (not as high as yours as a percentage, but still high) and can't figure out if it is something to be concerned about (mainly if it represents a 'wait' that is blocking or not). – drmrbrewer Jan 29 '21 at 13:05
  • 1
    Nope :( I fixed some other things which helped – Esqarrouth Jan 30 '21 at 07:20
  • epoll_wait processes any kind of IO depending on your app. The operation is costly, but not stated above. Usually this is e.g. an HTTP or FS operation and also usually an app misbehaviour. very likely the SocketServer.js file does not implement it's own timeouts. This is a typical issue in application code. Hence, I would accept the answer below. Maybe there is a very special issue with your application code. In that case I would post it here. – eljefedelrodeodeljefe May 16 '21 at 00:03
  • Also note: the respective implementation comes from libuv. The corresponding C-code only has one relevant location, which hints to a timeout. – eljefedelrodeodeljefe May 16 '21 at 00:09

1 Answers1

1

epoll_pwait essentially means your application (event loop) is waiting for something, i.e I/O operation.

Quoting the link above:

A call to epoll_pwait() will block until either:

   • a file descriptor delivers an event;

   • the call is interrupted by a signal handler; or

   • the timeout expires.

for further debugging, what really comes to my mind is, if you have any setInterval code with little or zero timeout, if so, please post this callback function you're passing to the interval.

Mu-Majid
  • 851
  • 1
  • 9
  • 16
  • 1
    `if so, please post this callback function you're passing to the interval` what do you mean here? – Esqarrouth Feb 04 '21 at 12:06
  • I mean if your application's code has a `setInterval` with zero or tiny timeout, please post this callback => `setInterval(callback, timeout)`, What I suspect is that callback have some sort of a loop and the callback itself is run in an infinite loop (by setInterval). I am talking from experience, as this situation did happen to me, and I found out that a set interval with tiny timeout and a callback with loop inside it caused the cpu to gradually increase to 100%. – Mu-Majid Feb 04 '21 at 16:30
  • Lowest I have is 50ms. Does that count `little` in your terms? – Esqarrouth Feb 15 '21 at 11:23
  • Oh ^ that is in the front end. The smallest I have in backend is 1 minute – Esqarrouth Feb 15 '21 at 11:24