• clinic 简单使用


    主要是学习clinic的使用,使用的官方demo

    环境准备

    • 安装
    npm install -g clinic 
    • 命令
    clinic --help
      Clinic - v5.0.0
      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
      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.
      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 the Clinic.js cloud. To do this, use clinic upload:
        clinic upload 1000.clinic-doctor
      Utilities
      When using Clinic.js a bunch you have fill up your directory with data folders and files.
      You can clean these easily using clinic clean.
      More information
      For information on the Clinic.js sub-commands, use the --help option:
        clinic doctor --help
        clinic bubbleprof --help
        clinic upload --help
        clinic clean --help
        clinic flame --help
      Flags
      -h | --help Display Help
      -v | --version Display Version

    demo 使用

    • clone 代码
    git clone https://github.com/nearform/node-clinic-doctor-examples.git
    • 运行
    cd node-clinic-doctor-examples
    yarn
    clinic doctor --autocannon [ / ] -- node ./slow-io
    • 性能报表

    从图上可以看出,有io问题,同时也包含了一些推荐的一些分析方法


    分析方法

    • 火焰图
     
    clinic flame -- node ./slow-io

    试压效果

    ab -n 2000 -c 20 http://localhost:3000/

    说明

    clinic功能上还真是比较强大,支持的分析模式也比较多,是一款很不错的nodejs应用内性能分析工具

    参考资料

    https://clinicjs.org/documentation/
    https://github.com/nearform/node-clinic

  • 相关阅读:
    npm脚本和package.json
    Vue官方文档笔记(二)
    Vue官方文档笔记
    2019windows上安装Mac OS 10.14过程详细截图
    三次握手四次挥手
    ==和equals的区别
    Stringbuffer和Stringbuilder的区别
    字符串拼接五种常用方法
    什么是线程以及保证线程安全
    什么是线程安全,怎样保证线程安全
  • 原文地址:https://www.cnblogs.com/rongfengliang/p/12591016.html
Copyright © 2020-2023  润新知