我在生产应用程序上遇到问题,有时使用100%的CPU。 我的NodeJS版本是v5.11.1
我想知道什么可以使用这个问题以及如何解决这个问题。所以我用节点模块“v8-profiler”来获取一些日志。我将此文件加载到Google Chrome开发者工具的配置文件选项卡中,我可以看到97%的时间用于快速会话的哈希方法,但这并不能告诉我这可能是什么原因。
此日志文件here的链接。
我想首先知道这是来自我的应用程序还是来自我正在使用的节点模块之一。
提前感谢您的帮助。
我的包json是:
{
"name": "",
"version": "1.0.0",
"description": "",
"author": "",
"main": "index.js",
"scripts": {
"test": "mocha",
"start": "node index.js"
},
"dependencies": {
"adm-zip": "^0.4.7",
"assert": "^1.4.0",
"async": "^1.5.2",
"bcrypt-nodejs": "^0.0.3",
"bundalo": "^0.2.10",
"connect-flash": "^0.1.1",
"connect-mongo": "^1.2.0",
"cookie-parser": "^1.4.3",
"cors": "^2.7.1",
"csurf": "^1.9.0",
"csv": "^0.4.6",
"csv-stringify": "1.0.4",
"date-utils": "^1.2.21",
"dust-makara-helpers": "^4.1.2",
"dustjs-helpers": "^1.7.3",
"dustjs-linkedin": "^2.7.2",
"express": "^4.13.4",
"express-bcp47": "^3.0.3",
"express-csv": "^0.6.0",
"express-session": "^1.13.0",
"forms": "^1.1.3",
"json2csv": "^3.4.2",
"kraken-devtools": "^1.2.3",
"kraken-js": "^2.1.0",
"localize": "^0.4.7",
"localizr": "^1.1.0",
"lodash": "^4.13.1",
"lusca": "^1.4.1",
"makara": "^2.0.3",
"mocha": "^2.5.3",
"moment": "^2.13.0",
"mongoose": "^4.4.19",
"morgan": "^1.7.0",
"nconf": "~0.8.4",
"node-forge": "^0.6.39",
"oauth2orize": "^1.3.0",
"passport": "^0.3.2",
"passport-http": "^0.3.0",
"passport-http-bearer": "^1.0.1",
"passport-oauth2-client-password": "^0.1.2",
"plist": "^1.2.0",
"request": "^2.69",
"temp": "^0.8.3",
"winston": "^2.2.0",
"winston-syslog": "^1.2.1"
},
"devDependencies": {
"assert": "^1.3.0",
"chai": "^1.10.0",
"faker": "^3.1.0",
"grunt": "^1.0.1",
"grunt-config-dir": "^0.3.2",
"grunt-contrib-clean": "^1.0.0",
"grunt-contrib-jshint": "^1.0.0",
"grunt-copy-to": "0.0.10",
"grunt-dustjs": "^1.4.0",
"grunt-mocha-cli": "^2.1.0",
"gulp": "^3.9.1",
"mocha": "^2.1.0",
"supertest": "^0.15.0"
},
"generator-kraken": {
"version": "1.1.1",
"template": "dustjs",
"css": false,
"js": false,
"task": "grunt"
}
}
答案 0 :(得分:1)
大多数库都是信誉良好的库,我相信它在您的代码中不符合您的要求。你可能想要分析一下,看看原因在哪里。
这是一个很长的主题,但很容易应用,有很多教程,我可以建议一些。
v8-profile
:这是一个很棒的教程:https://github.com/felixge/node-memory-leak-tutorial