Over the past few months, I have been building a DerbyJS application. Derby is absolutely changing the game as far as frameworks go. I won’t delve into the benefits or features here, but it’s built on top of standard npm modules like Express, Browserify, and Socket.io. This allows for immense customizability and compatibility with existing node solutions rather than the walled garden that other frameworks impose.
My Derby app has been running stably for months, but I was nearing the end of my yearly Linode subscription and felt compelled to switch things up. Here’s what I discovered in my research.
Roll Your Own
I ran my app for quite some time on a small Linode. The benefits are obvious. You have total control over your setup. This means you can support websockets out of the gate. However, unless you’re a sysadmin wizard, you’re going to spend quite some time doing maintenance and initial setup. I finally found a solution that worked for me, but eventually decided to move towards greener pastures with a PaaS provider. There’s something nice about not worrying about infrastructure or deployment. I recommend everyone give being a sysadmin a try just to explore what it takes to run your own server. After about a year, I decided I didn’t want to maintain it myself any more. But the experience was worth it’s weight in gold.
Brimming with hype off of hackathons and Hacker News, I was ecstatic to try out Nodejitsu. They promised websocket support out of the gate even when scaling horizontally with multiple drones (their cute name for extra processes). I tested it myself over many months before finally deciding to give it a production go. Although I really wanted to like nodejitsu, they made it very difficult. It would take 4-5
jitsu deploys every time I wanted to update my app due to obscure socket hangups. While they are very responsive in IRC, they often told me that large apps can cause these errors. Meanwhile my app is only about 300KB. Their web-panel, while slick, was unresponsive at times. I had a tough time logging in just to take a screenshot for this post.
While nodejitsu was one of the few to promise websocket support and have it actually work, their CPU seemed to be quite slow and therefore websocket’s speed suffered as a result. Unfortunately, I can’t recommend their service in its current iteration. There were just too many snags that I hit along the way.
Update: Since posting, Nodejitsu has made many improvements to their service. jitsu deploys actually work well and sites seem to hold up. But, my site has gone down twice with errors in the past few days. When entering IRC and asking why my site was down, the support blamed it on their router and said it would be reset in a few hours. Unfortunately, they could do nothing about it so here I was, sitting helpless while my sites were down for a few hours. That is unacceptable.
Yesterday, I was planning on launching a site on Nodejitsu and when I went to IRC for them to add an SSL certificate (something I’ve done before), they told me I couldn’t. When asked why, they said only business plans (another 40-50 bucks a month; something a student can’t afford) are allowed to use SSL. They never notified me of this change, just like they neglected to notify me for expected downtime.
Heroku doesn’t support websockets. Heroku is expensive. But, Heroku has been battle tested and can hold up to the heat. I’ve had a decent amount of experience with Heroku before giving them a go in a production environment and I have to say that the experience has been nothing but positive. No consistently obscure errors. No frills. It hosts my app, and it does it well. I was worried that
xhr-polling would be consistently slower than websockets, but that’s turned out to be false. In fact,
xhr-polling on Heroku was faster than websockets on Nodejitsu. I can’t explain why, but by comparing the two side-by-side it was blatantly true. I have yet to test out multiple dynos, but according to Tyler Renelle, his Derby app held up to about 1000 concurrent connections on a single Heroku dyno with
xhr-polling enabled. This is more than acceptable to me for the time being.
Heroku is not perfect, but it’s a very good option for hosting a small node application that doesn’t need to handle thousands of concurrent users. Plus, you’re first dyno is always free. My app is currently running on Heroku and handling it swimmingly.
Much to my surprise, I’ve had a very positive experience with Appfog. I went in quite skeptical, but my app was up and running in minutes. They give you something that no one else is able to offer. 2GB of memory for free. Plus, you’re able to spread that across up to 8 instances of your application… all for free! So, 8 instances running at 256 MB each right out of the gate! My Linode was only giving me 512 MB for one instance and it cost over $200 a year. I have yet to use this in a production environment, but through my own load-testing AppFog has held up better than almost every other provider. On top of which, they recently acquired Nodester thereby explicitly promising to have websocket support soon. Also, their web-panel works surprisingly well and I haven’t had any major issues with it.
I’m really excited about AppFog and have been seriously considering moving my app there full-time. Once websocket support comes through the pipeline, I have a feeling this might be the place I end up. Watch out for them, they’re clearly not going away without a fight.
To be honest, I never heard of this provider before yesterday. My favorite bassist plays a 5 string Modulus bass so the name certainly jumped out at me. I decided to give them a quick try – and I was pleased! My app was up and running within minutes sans issues. Their design is by far the worst out of all the providers, but they’re young. It seems they’re focused on providing useful analytics and as much data as possible which is something any sysadmin can appreciate. I can’t recommend them yet, but since it’s free [for now] it can’t hurt to take a look. Watch out for these guys. They’re up to something.
The node.js ecosystem is young and growing. There really isn’t a proper solution yet and, quite frankly, that sucks. But, the future is bright. I can’t wait to see what 2013 has for us in the land of node.
I would recommend using Heroku if you’re small or don’t have to support websockets. Keep your eyes on AppFog and Modulus. If you really want to scale a large websocket application, you’re probably looking at rolling your own solution using some sort of VPS/Dedicated provider. Good luck and Happy New Year!