clinicjs /node-clinic

Clinic.js diagnoses your Node.js performance issues

★ 5,946⑂ 133👁 53⑃ 211● 271▤ 23
JavaScriptMITCreated 2018-01-17clinicjs.org
Download: v13.0.0v13.0.0 ↓13.0.02023-06-28
-1
Daily
5,946
stars
133
forks
53
watchers
211
prs
271
issues
23
releases

README

Clinic.js

 [!NOTE]  
 Clinic.js is not being actively maintained. Due to its strong ties to Node.js internals, it may not work or the results you get may not be accurate.


[![npm version][npm-version]][npm-url] [![Stability Stable][stability-stable]][stability-docs] [![Azure build status][azure-status]][azure-url]
[![Downloads][npm-downloads]][npm-url] [![Code style][lint-standard]][lint-standard-url]

An Open Source Node.js performance profiling suite originally developed by [NearForm][].

Demo and detailed documentation: https://clinicjs.org/

 Install


npm install -g clinic




!Screenshots

 Getting started

As a first step, run the clinic doctor:

clinic doctor -- node server.js

Then benchmark your server with wrk or autocannon:


wrk http://localhost:3000
autocannon http://localhost:3000


If you want to run autocannon as soon as your server starts listening you can
use the --autocannon option using [subarg][] syntax.

sh
clinic doctor --autocannon [ / --method POST ] -- node server.js


Other benchmarking tools like wrk can be started in a similar way using the --on-port flag

sh
 $PORT is the port the server is listening on
clinic doctor --on-port 'wrk http://localhost:$PORT' -- node server.js


Finally shut down your server (Ctrl+C). Once the server process has shutdown
clinic doctor will analyse the collected data and detect what type of issue
you are having. Based on the issue type, it will provide a recommendation for
you.

For example, to debug I/O issues, use clinic bubbleprof:


clinic bubbleprof -- node server.js


Then benchmark your server again, just like you did with clinic doctor.

Note that when looking at the CPU graph you might notice that it doesn't
necessarily go from 0-100 but might go from 0-200 or higher. This is because the
percentage reflects the total amount of CPU cores your computer has. Node.js
itself uses more than one thread behind the scene even though JavaScript is
single threaded. V8 (The JavaScript engine) runs the garbage collector and some
optimizations on background threads. With worker threads, the CPU will also
utilize more than 100%. The visible percentage is always the combination of all
these factors together.

__NOTE__: Exiting the process forcefully can result in wrong or no generation of log files.

 Windows + PowerShell

In order to diagnose your application with node clinic, you should execute your application after double hyphens(--),
e.g: clinic doctor -- node myapplication.js.

On Windows using PowerShell as terminal the above statement might not work because PowerShell parses everything after --
as literal arguments instead of options.

To avoid that behavior you can either quote ("--", '--') or escape (--) the double hyphens.

 Supported Node.js versions

Clinic.js relies heavily on Node.js core instrumentation available in later versions.
Currently the supported Node.js versions are = 16.

 Examples and Demos

- A set of simple Doctor examples
- A set of simple Bubbleprof examples
- 

Top issues

Latest release

v13.0.0 v13.0.0 2023-06-28
What's Changed

 fix: adjust tests according to heapprofiler fix by @RafaelGSS in https://github.com/clinicjs/node-clinic/pull/403
 chore: drop v14 support by @RafaelGSS in https://github.com/clinicjs/node-clinic/pull/454


Full Changelog: https://github.com/clinicjs/node-clinic/compare/v12.1.0...v13.0.0

Snapshot: 2026-11-16T09:23:14Z · Data license Apache-2.0 · JSON