logo

Clinic Doctor

Diagnoses performance issues in your Node.js applications

Introduction

Doctor helps diagnose performance issues in your application and guides you towards more specialised tools to look deeper into your specific issues. Symptoms such as low CPU usage, blocking garbage collection, frequent event loop delay or a chaotic number of active handles may indicate a number of potential problems. Doctor helps narrow down the possibilities by generating a recommendation based on those symptoms. Examples such as I/O issues, non-optimized garbage collection and blocked event loop are quite common. Doctor will help you with all of these.

Read the introductory blogpost here

Once the problem is diagnosed, Doctor helps you find the right solution. It may point you to a specific profiling tool or suggest a common approach to the problem. For those who prefer more context, Doctor also provides an in-depth explanation of the issue. In situations where you have a hunch that the issue may be different than the recommendation, Doctor provides easy access to the documentation of all the other issues.

Try a live example here

Getting started

NOTE: You must use a version of Node.js >= 8.11.1

npm install -g clinic
npm install -g autocannon

Confirm that it has installed ok with:

clinic doctor --help

We have a set of example apps on GitHub. Let's run through the first one

git clone https://github.com/nearform/node-clinic-doctor-examples.git
cd node-clinic-doctor-examples
npm install
clinic doctor --on-port 'autocannon localhost:$PORT' -- node ./slow-io

This will run autocannon against a simple app with an IO issue and once it's complete, it will automatically launch the Doctor tool inside your browser.

Everything in Doctor is self-contained in that HTML file. There is extensive built-in help and documetation in the tool to guide you. You can try any of the other examples in the repo or use it on your own Node.js process. It will tell you where to look or what tool to use to drill into your specific problem(s).

Github Examples