GithubHelp home page GithubHelp logo

v8-perf-shield's Introduction

V8-Perf-Shield

V8应用性能守护者,当应用运行状态超过设定的警戒线后会触发救援函数,救援函数主要用于应急处理,比如自动重启进程,在救援函数中也可以获取到性能数据的历史以便输出到日志中。

如何安装

npm install --save v8-perf-shield

使用方法

'use strict';

var perfShield = require('v8-perf-shield');

perfShield({
    logsPath: '', // 分析文件保存路径,默认为当前路径
    samplingTime: 60, // 采样时间,用于CPU Profile的生成
    flushTime: 3, // 检查时间,用于定期检查系统用量
    cacheMaxLimit: 100, // 最大历史缓存条数,超过则滚动
    usageOptions: { keepHistory: true },

    emergencyCondition: function (lastUsage, currentUsage, usageHistory) {
        if (lastUsage.cpu > 5 && currentUsage.cpu > 5) {
            return true;
        }
    },

    emergencyAction: function (usageHistory) {
        console.log(usageHistory);
        process.exit(0);
    }
});

v8-perf-shield's People

Contributors

gorphone avatar paulguo avatar

Watchers

 avatar  avatar

Forkers

gorphone

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.