Skip to content

Monitor the memory footprint of your hapi app with an interactive time series graph.

Notifications You must be signed in to change notification settings

bencooling/memshaw

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Memshaw

Monitor your hapi application's memory footprint.

Screenshot

Inspired by PubNub-Rickshaw-Memory, this plugin displays a realtime graph of your NodeJS memory profile over time. It uses socket.io for pushing data to the browser and Shutterstock's Rickshaw library for graphing.

Usage

Hapi 16

  1. Add the memshaw plugin to your hapi installation, here I am using a manifest file with the glue plugin:
{
  ...
  registrations: [
    { plugin: { register: 'memshaw' } },
    ...
  ]
}
  1. Visit your application in the browser using the /memshaw path i.e. localhost:3000/memshaw

  2. Get your app to chew on some memory! For example you could have a terrible route that you curl http://localhost:3000/stress like this:

server.route({
  method: 'GET',
  path: '/stress',
  handler: (request, reply) => {
    const stupidBigArray = [];
    fs.createReadStream('/path/to/big/file', 'utf8')
      .on('data', (chunk) => {
        console.log('got %d bytes of data', chunk.length);
        stupidBigArray.push(chunk);
      });
    reply('Why are you pushing all these chunks to an array?');
  },
});

Hapi 17

const hapi = require('hapi');
const memshaw = require('memshaw/hapi-17');

(async function() {
  const server = hapi.server({port: 3000});

	await server.register([
			memshaw,
	]);

  await server.start();
})();

Resources

Rickshaw example

About

Monitor the memory footprint of your hapi app with an interactive time series graph.

Resources

Stars

Watchers

Forks

Packages

No packages published