SSH connection’s channel limit and Node.js

Recently while rebuilding Outkept, I learned something interesting. I knew there was a channel limit for each SSH connection, what I didn’t know was that the default limit was so low (usually 8 channels per connection by default in the majority of ssh daemons).

In Outkept each sensor uses a channel, if I exclusively used one channel per sensor that meant that only 8 sensors per server was allowed.

This meant that I needed to implement a queue based pool of some sort, in order to “multiplex” the available channels. Something like the gist below, just pass it a SSH2 module connection object and use the send method.

This code does not feature stream error treatment, so complement it or only use it when missing something isn’t important.

In this use case, each sensor interval is user defined, if someone defined a few sensors with intervals in the millisecond range the queue is going to quickly fill forever. I monitor this alerting the user in the dashboard for a “queued up” scenario, in this situation there is only two solutions: increase the intervals or increase the channels limit.

Advertisements

Codebits 2012

It was my third Codebits and by far the best one!

Codebits is an event which merges characteristics from a hackathon and a conference.

Organized and sponsored by Sapo, each year it has 800 handpicked attendees.

This year I decided to “walk the talk” and really participate into the spirit of the event: I gave a talk, saw talks, helped, got help, participated in a project (4th place :D). All this along three awesome days.

Unfortunately I didn’t have much time to meet new people, it happens when you are always running.

Here goes some photos to remember these three awesome days:

This slideshow requires JavaScript.