{"id":13431414,"url":"https://github.com/clinicjs/node-clinic","last_synced_at":"2025-05-13T15:10:47.181Z","repository":{"id":39375144,"uuid":"117836010","full_name":"clinicjs/node-clinic","owner":"clinicjs","description":"Clinic.js diagnoses your Node.js performance issues","archived":false,"fork":false,"pushed_at":"2024-09-19T09:48:16.000Z","size":2681,"stargazers_count":5785,"open_issues_count":104,"forks_count":125,"subscribers_count":52,"default_branch":"main","last_synced_at":"2025-04-23T18:56:01.356Z","etag":null,"topics":["nodejs"],"latest_commit_sha":null,"homepage":"https://clinicjs.org","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/clinicjs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-01-17T12:54:38.000Z","updated_at":"2025-04-22T11:45:47.000Z","dependencies_parsed_at":"2023-02-13T18:46:26.960Z","dependency_job_id":"a445344f-f351-417a-918d-a4d06286da09","html_url":"https://github.com/clinicjs/node-clinic","commit_stats":{"total_commits":243,"total_committers":43,"mean_commits":5.651162790697675,"dds":0.7860082304526749,"last_synced_commit":"95e73e6d8f41e35f93355a36a9017898f03d72f9"},"previous_names":[],"tags_count":63,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clinicjs%2Fnode-clinic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clinicjs%2Fnode-clinic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clinicjs%2Fnode-clinic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clinicjs%2Fnode-clinic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/clinicjs","download_url":"https://codeload.github.com/clinicjs/node-clinic/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253969248,"owners_count":21992263,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["nodejs"],"created_at":"2024-07-31T02:01:02.937Z","updated_at":"2025-05-13T15:10:42.125Z","avatar_url":"https://github.com/clinicjs.png","language":"JavaScript","readme":"# Clinic.js\n\n\u003e [!NOTE]  \n\u003e 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.\n\n[![Greenkeeper badge](https://badges.greenkeeper.io/nearform/node-clinic.svg)](https://greenkeeper.io/)\n[![npm version][npm-version]][npm-url] [![Stability Stable][stability-stable]][stability-docs] [![Azure build status][azure-status]][azure-url]\n[![Downloads][npm-downloads]][npm-url] [![Code style][lint-standard]][lint-standard-url]\n\nAn Open Source Node.js performance profiling suite originally developed by [NearForm][].\n\nDemo and detailed documentation: https://clinicjs.org/\n\n## Install\n\n```\nnpm install -g clinic\n```\n\n\u003cbr /\u003e\n\n![Screenshots](tools.gif)\n\n## Getting started\n\nAs a first step, run the `clinic doctor`:\n\n`clinic doctor -- node server.js`\n\nThen benchmark your server with `wrk` or `autocannon`:\n\n```\nwrk http://localhost:3000\nautocannon http://localhost:3000\n```\n\nIf you want to run autocannon as soon as your server starts listening you can\nuse the `--autocannon` option using [subarg][] syntax.\n\n```sh\nclinic doctor --autocannon [ / --method POST ] -- node server.js\n```\n\nOther benchmarking tools like wrk can be started in a similar way using the `--on-port` flag\n\n```sh\n# $PORT is the port the server is listening on\nclinic doctor --on-port 'wrk http://localhost:$PORT' -- node server.js\n```\n\nFinally shut down your server (Ctrl+C). Once the server process has shutdown\n`clinic doctor` will analyse the collected data and detect what type of issue\nyou are having. Based on the issue type, it will provide a recommendation for\nyou.\n\nFor example, to debug I/O issues, use `clinic bubbleprof`:\n\n```\nclinic bubbleprof -- node server.js\n```\n\nThen benchmark your server again, just like you did with `clinic doctor`.\n\nNote that when looking at the CPU graph you might notice that it doesn't\nnecessarily go from 0-100 but might go from 0-200 or higher. This is because the\npercentage reflects the total amount of CPU cores your computer has. Node.js\nitself uses more than one thread behind the scene even though JavaScript is\nsingle threaded. V8 (The JavaScript engine) runs the garbage collector and some\noptimizations on background threads. With worker threads, the CPU will also\nutilize more than 100%. The visible percentage is always the combination of all\nthese factors together.\n\n__NOTE__: Exiting the process forcefully can result in wrong or no generation of log files.\n\n### Windows + PowerShell\n\nIn order to diagnose your application with node clinic, you should execute your application after double hyphens(`--`),\ne.g: `clinic doctor -- node myapplication.js`.\n\nOn Windows using PowerShell as terminal the above statement might not work because PowerShell parses everything after `--`\nas literal arguments instead of options.\n\nTo avoid that behavior you can either quote (\"--\", '--') or escape (`--`) the double hyphens.\n\n## Supported Node.js versions\n\nClinic.js relies heavily on Node.js core instrumentation available in later versions.\nCurrently the supported Node.js versions are `\u003e= 16`.\n\n## Examples and Demos\n\n- [A set of simple Doctor examples](https://github.com/clinicjs/node-clinic-doctor-examples)\n- [A set of simple Bubbleprof examples](https://github.com/clinicjs/node-clinic-bubbleprof-examples)\n- [A MongoDB-based Bubbleprof demo/example](https://github.com/clinicjs/node-clinic-bubbleprof-demo)\n- [A Flame demo/example](https://github.com/clinicjs/node-clinic-flame-demo)\n\n## Report an issue\n\nIf you encounter any issue, feel free to send us an issue report at:\n\n```\nhttps://github.com/clinicjs/node-clinic/issues\n```\n\n## More information\n\nFor more information use the `--help` option:\n\n```\nclinic doctor --help\nclinic bubbleprof --help\nclinic flame --help\nclinic heapprofiler --help\n```\n\n- The `doctor` functionality is provided by [Clinic.js Doctor](https://github.com/clinicjs/node-clinic-doctor).\n- The `bubbleprof` functionality is provided by [Clinic.js Bubbleprof](https://github.com/clinicjs/node-clinic-bubbleprof).\n- The `flame` functionality is provided by [Clinic.js Flame](https://github.com/clinicjs/node-clinic-flame).\n- The `heapprofiler` functionality is provided by [Clinic.js Heap Profiler](https://github.com/clinicjs/node-clinic-heap-profiler).\n\n## Flags\n\n```\n-h | --help                Display Help\n-v | --version             Display Version\n--collect-only             Do not process data on termination\n--visualize-only datapath  Build or rebuild visualization from data\n--on-port                  Run a script when the server starts listening on a port.\n--autocannon               Run the autocannon benchmarking tool when the server starts listening on a port.\n--dest                     Destination for the collect data (default .).\n--stop-delay               Add a delay to close the process when a job is done through either `autocannon` or `on-port` flag (milliseconds)\n--name                     The --name flag sets a name for the output data, allowing you to replace existing reports without generating new ones. Example: \u003ccode\u003e.clinic/node-19-test.clinic-flame\u003c/code\u003e\n```\n\n## Programmable Interfaces\n\nEach of the tools has a programmable interface which you can read about in their repos.\n\n- [Clinic.js Doctor](https://github.com/clinicjs/node-clinic-doctor)\n- [Clinic.js Bubbleprof](https://github.com/clinicjs/node-clinic-bubbleprof)\n- [Clinic.js Flame](https://github.com/clinicjs/node-clinic-flame)\n- [Clinic.js Heap Profiler](https://github.com/clinicjs/node-clinic-heap-profiler)\n\n## Profiling In [Podman](https://podman.io/) Container\n_Applicable for `doctor`, `bubbleprof`, `flame` or `heapprofiler`_\n\nIn case you profile your application inside of container environment using [podman](https://podman.io/) (docker alternative).\nAnd you start profling by providing `CMD` step in the dockerfile.\n```\nCMD clinic flame -- node index.js\n```\nThen when you run container it exits immediately with `0` code.\nIt is caused by a [question to collect anonymous usage statistics](https://github.com/clinicjs/node-clinic/issues/79#issuecomment-1226515723).\n\nA workaround is to use environment variable `NO_INSIGHT` with any value.\nIn this case the question to collect anonymous usage statistics is suppressed. Thus profinling and application server start as expected.\n```\nCMD NO_INSIGHT=true clinic flame -- node index.js\n```\n\n## License\n\n[MIT](LICENSE)\n\n[stability-stable]: https://img.shields.io/badge/stability-stable-green.svg?style=flat-square\n[stability-docs]: https://nodejs.org/api/documentation.html#documentation_stability_index\n[npm-version]: https://img.shields.io/npm/v/clinic.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/clinic\n[npm-downloads]: http://img.shields.io/npm/dm/clinic.svg?style=flat-square\n[lint-standard]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square\n[lint-standard-url]: https://github.com/feross/standard\n[azure-status]: https://dev.azure.com/node-clinic/node-clinic/_apis/build/status/nearform.node-clinic\n[azure-url]: https://dev.azure.com/node-clinic/node-clinic/_build/latest?definitionId=1?branchName=master\n[nearform]: https://www.nearform.com\n[subarg]: https://npmjs.com/package/subarg\n","funding_links":[],"categories":["JavaScript","Repository","目录"],"sub_categories":["Performance Profiling/Analysis"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclinicjs%2Fnode-clinic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclinicjs%2Fnode-clinic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclinicjs%2Fnode-clinic/lists"}