Skip to content

Commit

Permalink
feat(config): now cpuRecordTime can configure
Browse files Browse the repository at this point in the history
  • Loading branch information
huangyoukun committed Nov 22, 2018
1 parent 43ad32f commit b1e1d4c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bin/proxy/http.proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ process.on('profiler', function(data = {}) {
}

require('util/v8-profiler.js').writeProfilerOpt(__dirname + '/cpu' + serverInfo.cpu + '.' + Date.now() + '.cpuprofile', {
recordTime: data.time || 5000
recordTime: data.time || config.cpuRecordTime
}, function(filename) {
logger.info('dump written to ${filename}', {
filename: filename
Expand Down Expand Up @@ -446,7 +446,7 @@ function afterCpu80(cpuUsed) {
}

if (profiler) {
profiler.getProfiler({ recordTime: 5000 }, profCallback);
profiler.getProfiler({ recordTime: config.cpuRecordTime }, profCallback);
} else {
profCallback();
}
Expand Down
3 changes: 3 additions & 0 deletions bin/tsw/default/config.default.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ this.memoryLimit = 768 * 1024 * 1024 * (mpc >= 2 ? 1.5 : 1);
// 限制
this.CCIPLimit = 200;

// CPU快照抓取时间
this.cpuRecordTime = 5000;

// 超限后自动拉黑
this.CCIPLimitAutoBlock = false;

Expand Down

0 comments on commit b1e1d4c

Please sign in to comment.