Alex Barth on Node.js and Express versus Drupal

Podcast episode player
0:00 0:00

Alex Barth talks about Development Seed's recent focus on using technologies like node.js, Express and CouchDB. He compares this Server-side JavaScript stack as best he can to what Drupal does with the LAMP stack, as well as how this node.js/Express approach is better suited for dealing with data-intensive web applications. Development Seed has been using it for Tilemill and Tilestream Hosting, but node.js it not used in their iOS application MapBox for the iPad.

As described in this developerWorks article, "Node.js is a server-side JavaScript interpreter that changes the notion of how a server should work. Its goal is to enable a programmer to build highly scalable applications and write code that handles tens of thousands simultaneous connections on one, and only one, physical machine."

Node.js itself is written in C/C++ since it's built on top of Google V8 JavaScript Engine, but the applications like Express are written in JavaScript.

Again quoting a developerWorks explanation:

The V8 JavaScript engine is the underlying JavaScript engine that Google uses with their Chrome browser. Few people think about what actually happens with JavaScript on the client. A JavaScript engine actually interprets the code and executes it. With V8, Google created an ultra-fast interpreter written in C++ that has another unique aspect; you can download the engine and embed it in any application you wish. It's not restricted to running in a browser. Therefore, Node actually uses the V8 JavaScript engine written by Google and re purposes it for use on the server.

Node.js and it's JavaScript applications are event-based instead of linear like PHP. For example, if you do a MySQL query in PHP, that means you have to wait for the response to come back before you can continue. Node.js on the other hand sets up a handler for "when the MySQL query finishes, execute this function." This means that you can do other stuff while the MySQL query (or any other activity that takes a lot of time) finishes.

Barth talks more about how Development Seeds enjoys the elegance of being able to processing large chunks of data stream in real-time as soon as the first bytes of the data are received, and he talks about what the Express framework does and does not provide in the equivalent Drupal speak of terms and hook functions.

I also got a chance to talk with ZivTech's Justin Rendell at DrupalCon Chicago, who has written a Node.js Integration Drupal module in order to do real-time chatting a better experience with other modules like the Chat Room module. I'll be releasing that interview next week. UPDATE: Here's that interview with Justin Randell.

Interestingly, most of the development of node.js development is being coordinated through github, and since there's no centralized repository or issue queue, most features/bug fixes come in as pull requests on this GitHub repository: https://github.com/joyent/node/pulls

Node.js also just held a one-day NodeConf in Portland, OR, which over half of Development Seed attended. Barth talks about how node.js is still an emerging technology, but is really excited to see it mature over the next couple of years.