node js cpu 100%

前端 未结 5 1986
花落未央
花落未央 2020-12-24 13:13

We\'re having a problem where every once in a while one of our environments our node app runs on 100% CPU. The server isn\'t very active and usually runs on 0%-2% CPU. I was

5条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-24 13:42

    UPDATE 2019 !!

    You better use the built in --prof-process to process v8 profiling data, the generated file is no longer v8.log and node-tick-processor won't help you much, so to profile your app and read the v8 profiling data you can proceed as follows:

    node --prof your_script.js
    

    Node will generate a file with a name like this isolate-0x103800000-v8.log in your current directory, now you use this file to generate a profiling report

    node --prof-process isolate-0x103800000-v8.log > processed.txt
    

    Simple profiling

提交回复
热议问题