clinicjs / node-clinic

Clinic.js diagnoses your Node.js performance issues
https://clinicjs.org
MIT License
5.67k stars 125 forks source link

no Userland area in bubbleporf #434

Open alvinlys opened 2 years ago

alvinlys commented 2 years ago

Hi, my bubbles shows Userland is disabled, does that implies all the issue is coming from native nodejs?

image
RafaelGSS commented 2 years ago

It depends on several factors:

alvinlys commented 2 years ago

Thank you and really appreciate on your help.

  • Are you generating load to your application?

Yes, i did use autocannon of 500 requests, but it happened every time i profile

  • For how much time?

30s, but happened every time too

  • Node version?

v16.14.2

  • Can you create a minimal reproducible code?

Here is the sample of my code

RafaelGSS commented 2 years ago

Here is the sample of my code

The code you uploaded looks invalid (https://github.com/alvin30595/gist-1/blob/main/app.js#L4), can you create a minimal reproducible code?

Just an important note, I've noticed that most of your code makes assumptions on some transpiler (webpack, for instance), remember to profile your application after the transpilation. The clinic.js must run against the code that runs in production.

alvinlys commented 2 years ago
RafaelGSS commented 2 years ago

May i know what do you mean by invalid code?

This import is invalid:

import EventEmitter from '#root/configs/event.js'

alvinlys commented 2 years ago

I dont think there is any issue on it as i could start the node application. the #root actually is a Subpath imports mentioned in package.json file, and i used ESM ways to import. Pls do correct me if i'm wrong, open for discussions

RafaelGSS commented 2 years ago
> nodemon app.js

[nodemon] 2.0.15
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node app.js`
[ioredis] Unhandled error event: ClusterAllFailedError: Failed to refresh slots cache.
    at tryNode (/home/rafaelgss/repos/os/tests/gist-1/node_modules/ioredis/built/cluster/index.js:401:31)
    at /home/rafaelgss/repos/os/tests/gist-1/node_modules/ioredis/built/cluster/index.js:418:21
    at /home/rafaelgss/repos/os/tests/gist-1/node_modules/ioredis/built/cluster/index.js:677:24
    at run (/home/rafaelgss/repos/os/tests/gist-1/node_modules/ioredis/built/utils/index.js:157:22)
    at tryCatcher (/home/rafaelgss/repos/os/tests/gist-1/node_modules/standard-as-callback/built/utils.js:12:23)
    at /home/rafaelgss/repos/os/tests/gist-1/node_modules/standard-as-callback/built/index.js:33:51
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
Error: connect ECONNREFUSED 127.0.0.1:3306
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1187:16) {
  errno: -111,
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '127.0.0.1',
  port: 3306,
  fatal: true
}
WORKERPOOL started
[ioredis] Unhandled error event: ClusterAllFailedError: Failed to refresh slots cache.
    at tryNode (/home/rafaelgss/repos/os/tests/gist-1/node_modules/ioredis/built/cluster/index.js:401:31)
    at /home/rafaelgss/repos/os/tests/gist-1/node_modules/ioredis/built/cluster/index.js:418:21
    at /home/rafaelgss/repos/os/tests/gist-1/node_modules/ioredis/built/cluster/index.js:677:24
    at run (/home/rafaelgss/repos/os/tests/gist-1/node_modules/ioredis/built/utils/index.js:157:22)
    at tryCatcher (/home/rafaelgss/repos/os/tests/gist-1/node_modules/standard-as-callback/built/utils.js:12:23)
    at /home/rafaelgss/repos/os/tests/gist-1/node_modules/standard-as-callback/built/index.js:33:51
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
[ioredis] Unhandled error event: ClusterAllFailedError: Failed to refresh slots cache.

Your code has a pre-configuration, I can't run it locally. Can you please create a Minimal, reproducible example?

alvinlys commented 2 years ago

Thanks again for helping me. However, may I know how should I provide an example when my code would require redis and database, shall I provide the credentials to redis and database or provide an docker-compose file?

RafaelGSS commented 2 years ago

Try to create an application from scratch mocking those services, thus, I will be able to see in which part of your code is the bug

alvinlys commented 2 years ago

image

i had removed most of the unnecessary code & able to test locally without any dependencies. Things get interesting that with the new code, clinic doctor report "Event Loop issue: Event Loop Utilization" instead of previous "I/O issue: CPU Usage"