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

slacker

v1.2.0

Published

Boot services only when needed, otherwise go back to bed.

Downloads

2

Readme

https://travis-ci.org/timoxley/slacker.png

Slacker

Save precious system resources by creating lazy network services that are only spawned when required.

How

Slacker listens for arbitrary TCP connections on behalf of your resource hungry processes, allowing them to remain dormant until required.

When a request for that service comes in, slacker buffers the request, boots the service if it is not already running, and forwards the connection to the service; this is only feasible because node processes boot reasonably quickly (<10ms).

After a specified timeout, if all the connections are closed and there are no new connections, slacker will shutdown/terminate the worker process, until the next request for it arrives.

Slacker should support any protocol built on top of TCP, such as HTTP, MQTT and WebSockets.

Example

var slacker = require('slacker')

slacker(__dirname + '/some-http-service.js') // service to forward requests to
.timeout(10000) // service will be shut down after 10s of no active connections (default)
.listen(9000, function(err, port) { // listen on port 9000
  if (err) return console.error(err)
  console.log('slacker listening on %d', port)
})

Why

If you have a process or number of processes that need to respond to network events but consume an unsustainable amount of system resources while they are running, it is efficient to simply shut these services down while they are not required!

Node doesn't currently have a non-hacky, reliable mechnism for unloading modules from memory, and this is ok, because there's a good workaround: The easiest way to clean up memory and prevent unnecessary idle work is to just isolate that work to a process and kill it when it is no longer required. This is the job of slacker.

Node 0.8.x support

Normally, slacker can deduce what port your worker is listening on but if you're using node < 0.9.2 this feature, mean you must manually have your worker tell the slacker process what port it's listening on:

Node 0.8.x Example

//In the app you want spawned by slacker
var app = http.createServer()
app.listen(function() {
  process.send && process.send(app.address()) // Node < 0.9.2 support
})

If you're using node 0.9.2 and above, you do not need to do this.

Licence

MIT