"You Should Be Urinating Right Now" (A Real-Time Web Server)

As part of our Engineer-to-Engineer series of talks on topics such as HadoopScalaHTML5Cassandra and Clusto, Redfin invited Ryan Dahl to speak last Wednesday on Node.JS, a web server he created using JavaScript. It was a stupendous talk.

Now, I know what you’re thinking. For a core back-end technology like a web server, why use JavaScript, a technology that for much of its history has been used to run cute little animations within your browser?

Well, it turns out that JavaScript is very good at non-blocking programming, setting boundaries on what a program can and can’t do so that the little animations running on your favorite web page don’t lock up your whole computer. And it’s good for callback-style programming, so a program can wait for another program to do its thing without using up a lot of resources in the meantime.

This turns out to be a perfect solution for a web server handling a large number of users doing a lot of little things in real-time, like Twitter tweets or Facebook updates or even comments on properties, favorites and x-outs. The problem these programs face isn’t using your computer’s whole processor to solve an advanced physics problem. No, their problem is mostly just storing in a database a fire-hose of tiny bits of data, and zipping information between all the other computers being used to keep a site like Twitter or Facebook up and running.

Well it turns out that JavaScript, the humble scripting language once largely confined to the web browser running on your laptop, is a perfect framework for a lot of these back-end communications. Node.JS, the web server Ryan Dahl created in JavaScript, can easily ask a database to store a tweet without actually waiting for the database to store it; the server just moves on to the next task. This allows the web server to a do a lot of little things very fast, for very many people, which is exactly what a web server often has to do.

Ryan’s central insight in a world of networked computers is that it’s never your computer’s processor that slows you down anymore, it’s the inputs and outputs used to connect the computer to file servers and other computers. So rather than just trying to be computationally efficient, Node.JS focuses on being efficient in how a program deals with streams of information.

Even though a big website may use different web servers that have better security or more institutional support, there might be a place alongside those web servers for a Node.JS server as a hub for sending requests to other databases and servers. Suffice it to say, Ryan Dahl’s talk was a fascinating exploration of how technology may change to support real-time streaming functions.

And Ryan was a dazzling speaker, somehow both opinionated and scrupulous. Among the highlights:

On V8, Google Chrome’s JavaScript engine: V8 is a masterpiece of engineering. Google took the 14 best VM engineers and locked them in a closet in Denmark. They were given the JavaScript spec and then told to make it fast.

On Node.JS’s performance as compared to other web servers: This should be shocking to you. You should be urinating right now. Or getting angry. It shocks me.

On the performance problems created because the popular programming language Ruby on Rails doesn’t make it easy to talk to a database while doing other things : It’s the year 2010, we’re using Rails, and when you access a database, it stops, the world stops for who knows how long, the database might be in LA, and it takes 2 seconds to respond.

But don’t take my word for it. Read the we-typed-as-fast-we-could transcript of his talk! And for a list of upcoming talks, visit the event’s Facebook page.

Discussion

  • http://www.findire.com/Property_For_Sale_Miami-Florida-United_States/3/0/0 Miami Houses

    I appreciate this post. Very interesting Real estate blog. Hope it will always be alive! Thanks for this