Giter VIP home page Giter VIP logo

node-clinic's Introduction

Clinic.js

Greenkeeper badge npm version Stability Stable Azure build status Downloads Code style

An Open Source Node.js performance profiling suite 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.

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

# $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.

Supported Node.js versions

Clinic.js relies heavily on Node.js core instrumentation available in later versions. Currently the supported Node.js versions are ^10.0.0 and ^8.9.4.

Examples and Demos

Report an issue

If you encounter any issue, feel free to send us an issue report at:

https://github.com/nearform/node-clinic/issues

When creating an issue, it will be a huge help for us if you upload your data to Clinic.js Upload. To do this, use clinic upload:

clinic upload .clinic/1000.clinic-doctor

and include the URL that it returns.

More information

For more information use the --help option:

clinic doctor --help
clinic bubbleprof --help
clinic flame --help
clinic upload --help
clinic ask --help

Flags

-h | --help                Display Help
-v | --version             Display Version
--collect-only             Do not process data on termination
--visualize-only datapath  Build or rebuild visualization from data
--on-port                  Run a script when the server starts listening on a port.
--autocannon               Run the autocannon benchmarking tool when the server starts listening on a port.
--dest                     Destination for the collect data (default .).

Programmable Interfaces

Each of the tools has a programmable interface which you can read about in their repos.

License

GPL 3.0

node-clinic's People

Contributors

admataz avatar alansl avatar andreasmadsen avatar azure-pipelines[bot] avatar bridgear avatar davisjam avatar gillesdemey avatar goto-bus-stop avatar greenkeeper[bot] avatar iamstuartwilson avatar jasnell avatar kaylangan avatar kudos avatar lucamaraschi avatar mafintosh avatar mattmorgis avatar mcollina avatar mrister avatar pi0 avatar trivikr avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.