Hey everyone!
This is my first release to this mailing list - so hopefully I get this right. =)
I’d like to present to you PowerHouse, a NodeJS module that enhances scaling across processes in an easy fashion, that does not require a cli program or much of a restructure in your app. In fact, you can just drop it into your app and toy around and find a configurationt hat satisfies your needs!
What PowerHouse does:
- It helps you scale your application across processes in an easy way.
- Give you the opportunity to create a child process that can idle alongside your app just fine. You could talk to it using Redis Pub/Sub.
- Allow you to use sticky sessions. For instance, Socket.IO needs ~3 requests to perform the handshake. If only one request hits a different worker than the one the handshake was started in, you will run into issues! PowerHouse can help you out there. It sticks your client to a server and keeps them that way.
- It can create a net.Server on the main process and forward the incoming connection to one worker process at a time. This is an alternative way of balancing requests. You could use this as a load-balancer or proxy mechanism, maybe.
- Restart a worker that died.
What PowerHouse DOES NOT do:
- Require you to use a CLI application.
- Needing to inject code into yours.
- A special app layout. You decide how it’s laid out, no questions asked.
- Interfere with the rest of your stuff. All it wants is to be called once on a worker so that handlers are set up and alike.
I’d be happy about feedback, and ideas!
It should be noted that the sticky session doesn’t work just yet. I have to yet implement it, but the base is already present! You also currently can not hot-reload workers. Thus there is no mechanism to close sockets that are remaining from a dead process.
You can see a test in the test/ folder.
Kind regards,
Ingwie!