Node.JS开源:Memeye - 轻量级内存监控工具
rmll4556
8年前
<p style="text-align:center"><img src="https://simg.open-open.com/show/2f6fc7620c009da166b9632d418aa95f.png"></p> <h2>Memeye</h2> <p><a href="/misc/goto?guid=4959740699224023967" rel="nofollow,noindex">中文版</a></p> <h2>Introduction</h2> <p>Memeye is a lightweight NodeJS process monitoring tool that provides data visualization of process memory, V8 heap space memory, and operating system memory.</p> <p>The front part, with <a href="/misc/goto?guid=4958977564508786080" rel="nofollow,noindex">Vue2</a> and <a href="/misc/goto?guid=4959740699339106437" rel="nofollow,noindex">ChartJS</a> , provides a nice dynamic dashboard.</p> <p>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.</p> <p>This will minimize the impact of Memeye's code on the host process to ensure the authenticity of the data.</p> <h3>Feature</h3> <ul> <li>Lightweight</li> <li>Simple</li> <li>For development</li> <li>Visualization</li> </ul> <p>Note: Memeye only support a single process, NodeJS distributed process is not applicable, it is not recommended in the product environment。</p> <h2>Motivation</h2> <p>As we all know, NodeJS is very sensitive to memory.</p> <p>In April last year I used NodeJS to build a marketing project, on the day of project online PV broke one million.</p> <p>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.</p> <p>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).</p> <p>Recently there is time, once again turned out to reorganize and revision, add more type of the data display.</p> <h2>Demo</h2> <p><a href="/misc/goto?guid=4959740699415534221" rel="nofollow,noindex">See preview demo</a></p> <h2>Compatibility</h2> <ul> <li>Node v7.x</li> <li>Node v6.x</li> </ul> <h2>Install & Usage</h2> <p>For install simply run :</p> <pre> <code class="language-http">npm install memeye --save-dev</code></pre> <p>Then require it in your nodejs application</p> <pre> <code class="language-http">const memeye = require('memeye'); memeye();</code></pre> <p>Then open your browser and load address:</p> <pre> <code class="language-http">http://localhost:23333 //23333 port by defaul.</code></pre> <p>That's it! No more options, no more config, just so easy.</p> <h2>How it works</h2> <p>Memeye has three core concept: Collector, Indicator and Dashboard.</p> <p>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.</p> <h2>Collector</h2> <p>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.</p> <h2>Indicator</h2> <p>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.</p> <h2>Dashboard</h2> <p>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.</p> <p>Then bind the indicator with process IPC channel, to recive massage from parent process.</p> <p>And then bind the indicator with socket.io, to send messages while indicator attrbutes changed.</p> <h2>The commication between Collector, Indicator and Dashboard</h2> <p><img src="https://simg.open-open.com/show/71ac164e8c7e7b411ef7bd567a0082cd.jpg"></p> <h2>Test</h2> <p>Simply run:</p> <pre> <code class="language-http">npm test</code></pre> <h2>Some feature may be</h2> <ul> <li>Mutil process support</li> <li>Report export</li> </ul> <h2>License</h2> <p><a href="/misc/goto?guid=4959740699507368453" rel="nofollow,noindex">MIT License</a></p> <p>Copyright (c) 2016-2017 JerryC</p> <p> </p> <p> </p>