Code Monkey home page Code Monkey logo

memeye's Introduction

memeye logo

Build Status npm version Package Quality npm license

Memeye

中文版

Introduction

Memeye is a lightweight NodeJS process monitoring tool that provides data visualization of process memory, V8 heap space memory, and operating system memory.
The front part, with Vue2 and ChartJS, provides a nice dynamic dashboard.
Memeye in the host process, only the implantation of a simple data collector, the other work is to start a child-process, by the child-process to carry out.
This will minimize the impact of Memeye's code on the host process to ensure the authenticity of the data.

Feature

  • Lightweight
  • Simple
  • For development
  • Visualization

Note: Memeye only support a single process, NodeJS distributed process is not applicable, it is not recommended in the product environment。

Motivation

As we all know, NodeJS is very sensitive to memory.
In April last year I used NodeJS to build a marketing project, on the day of project online PV broke one million.
Which is showing a continuous upward trend in memory, in the process of troubleshooting problems, i want to find a lightweight, as long as the visual display of the use of memory tools, but no result.
Then there is the idea of this project, but at that time because of the busy only made a simple Demo to use (Memeye v0.0.3).
Recently there is time, once again turned out to reorganize and revision, add more type of the data display.

Demo

See preview demo

Compatibility

  • Node v7.x
  • Node v6.x

Install & Usage

For install simply run :

npm install memeye --save-dev

Then require it in your nodejs application

const memeye = require('memeye');
memeye();

Then open your browser and load address:

http://localhost:23333  //23333 port by default.

That's it! No more options, no more config, just so easy.

How it works

Memeye has three core concept: Collector, Indicator and Dashboard.
While Collector runing in your nodejs process, Indicators and Dashboard runing on the child-process, in this way Memeye will make as little influence as possible to your nodejs process.

Collector

Collector will wathching and collecting data from the host node process、v8 heap and operrating system ,then send the datas to dashboard process with IPC communication channel.

Indicator

Indicator like a state machine . When attribute changed, the instance of Indicator will emit an event. So we can use it to handle our indicators data of process, v8 heap and OS.

Dashboard

The dashboard , will calling at the child process way. It will create an Indicator instance and start a http server which provide a socket.io instance.
Then bind the indicator with process IPC channel, to recive massage from parent process.
And then bind the indicator with socket.io, to send messages while indicator attrbutes changed.

The commication between Collector, Indicator and Dashboard

commication.jpeg

Test

Simply run:

npm test

Some feature may be

  • Mutil process support
  • Report export

License

MIT License

Copyright (c) 2016-2017 JerryC

memeye's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

memeye's Issues

Dashboard extend

src/dashboard/index.js should provide api below:

  1. start
  2. addMonitor
  3. removeMonitor

集成时出现错误

集成时出现错误

node --debug-brk=28769 --nolazy majiang_server\app.js Debugger listening on port 28769 [Memeye] Memeye seting up...... Error: listen EADDRINUSE :::28769 at Object.exports._errnoException (util.js:953:11) at exports._exceptionWithHostPort (util.js:976:20) at Agent.Server._listen2 (net.js:1253:14) at listen (net.js:1289:10) at Agent.Server.listen (net.js:1385:5) at Object.start (_debug_agent.js:21:9) at startup (node.js:86:44) at node.js:449:3
Uploading QQ截图20170330100205.png…

Show heap statistics of V8

This is belong process heap, should create new chart to show heap statistics.
And get info from V8.getHeopStatistics()

setup babel

dist compiled from src.
By this way, i can use all ES6 feature and make it compatible with lower nodejs version

Build client framework

  1. public, 作为编译后的所在地,src/dashboard/worker.js引用该文件夹,启动http服务器,作为服务端。
  2. client,作为前端源码所在,考虑加入webpack工作流

channel closed error in cluster mode

When starting an app in cluster mode using pm2( pm2 start app_file -i 16), it keeps showing channel closed error in pm2 log file.
Error: channel closed at ChildProcess.target.send (internal/child_process.js:562:16) at Timeout.that.interval.setInterval (/var/www/node/express/node_modules/memeye/src/lib/Collector.js:57:24) at Timeout._onTimeout (/var/www/node/express/node_modules/async-listener/glue.js:188:31) at ontimeout (timers.js:380:14) at tryOnTimeout (timers.js:244:5) at Timer.listOnTimeout (timers.js:214:5)

Provide options config

The user can config something below:

  1. interval time
  2. host port of dashboard page
  3. and so on...

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.