Memeye
Github link: github.com/JerryC8080/…
Memeye is a lightweight NodeJS process monitoring tool that provides visualization of process memory, V8 heap space memory, and operating system memory. The front end, with Vue2 and ChartJS, provides a nice dynamic display panel. Memeye implants a simple data collector into the host process and starts a child process to do the rest of the work. This minimizes the impact of Memeye’s code on the host process to ensure data authenticity.
The characteristics of
- lightweight
- simple
- Development oriented environment
- visualization
Note: Memeye currently supports only single processes, NodeJS distributed processes are not yet available, so it is not recommended to use in production environments.
motivation
NodeJS is known to be memory sensitive. I did a marketing project with NodeJS in April last year, and the PV exceeded 100W the day it went live. Memory continued to rise. In the process of troubleshooting, I tried to find a lightweight tool that visualized the memory usage, but failed. Then I had the idea of this project, but at that time I only made a Demo level because I was busy, which was easy to use and released. Recently, I have time to turn it over again, reconstruct the revision, and add more dimensions of data display.
Demo
See preview demo (maybe climb the wall)
compatibility
- Node v7.x
- Node v6.x
Installation & Use
Run the following command to install:
npm install memeye --save-devCopy the code
And then introduce it into your code
const memeye = require('memeye');
memeye();Copy the code
Finally open your browser and type in the following address:
http://localhost:23333 //23333 port by defaul.Copy the code
It’s that simple!
How does Memeye work
Memeye has three core concepts: Collector, Indicators and Dashboard. The Collector runs in the host process (your NodeJS process) and indicators and Dashboards run in child processes to minimize the impact of Memeye code on your host process.
Collector
The Collector listens to the host process, collects data, and then sends the data to the child process via the IPC communication pipe for processing.
Indicator
Indicator is like a state machine. When its properties change, events are triggered. So we can use it to process the data that we collect.
Dashboard
Dashboards are invoked as child processes. He will create an Indicator instance and launch an Http server that integrates socket.io. Indicator is then bound to the process communication channel to receive data from the parent process. Finally, you can bind Indicator and socket. IO to send data to the front end when Indicator attributes change.
Communication between Collector, Indicator and Dashboard
preview