npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

scalemate

v1.0.5

Published

Scales your application servers by publishing custom CloudWatch metrics which are not available by default.

Downloads

29

Readme

scalemate

npm version

A Node.js package that scales your application servers by publishing custom CloudWatch metrics which are not available by default, such as:

  • Memory Available - amount of system memory available
  • Sockets Used - number of open client/server connections

Scalemate supports per-second metric resolution and defaults to per-minute.

Usage

First, install the package using npm:

npm install -g scalemate

Then, create a file called config.js and paste the following inside it:

module.exports = {
    // Metrics to publish
    metrics: {
        // Number of open socket connections
        socketsUsed: {
            // Whether to publish this metric
            enabled: true,
            // CloudWatch unit type
            unit: 'Count',
            // CloudWatch metric title
            name: 'Sockets Used'
        },
        // Number of megabytes of system memory currently available
        memoryAvailable: {
            // Whether to publish this metric
            enabled: true,
            // CloudWatch unit type
            unit: 'Count',
            // CloudWatch metric title
            name: 'Memory Available'
        }
    },
    // CloudWatch namespace to associate metrics with
    namespace: 'MyApp',
    // AWS IAM user with CloudWatch read/write access
    credentials: {
        region: 'us-east-1',
        accessKeyId: 'ABCDEFG',
        secretAccessKey: 'ABCDEFGHIJK/HIJKLMNOPQRS'
    }
};

Modify the configuration file according to your own needs, enabling or disabling metrics and configuring the following parameters:

  • namespace - the name of your app or server cluster
  • credentials - an AWS IAM user with read/write access to CloudWatch

Test the configuration by running:

scalemate

Observe the terminal output for any initial errors and for successfully-published metrics. If no errors are emitted, you have successfully configured Scalemate.

Visit the CloudWatch console and find the published metrics under the Scalemate namespace: https://console.aws.amazon.com/cloudwatch/home?region=us-east-1#

You can now configure CloudWatch alarms to scale your EC2 instances up or down based on these metrics.


Leave the tool running on a remote server by executing the following command:

scalemate > ~/scalemate.log &

To start Scalemate automatically after system reboots, add the following to your user's crontab:

@reboot scalemate -c /path/to/config.js > ~/scalemate.log &

License

Apache 2.0