Node.js from Ryan Dahl (JS Conf 2009)

I’m a bit late with that one, but I wanted to have an overview of Node.js from the man behind it. So I watched the presentation from Ryan Dahl at JS Conf Berlin 2009.

 

Here are my notes:

Apache vs nginx

  • Apache uses OS threads
  • nginx uses an event loop

Threads

  • context switching is not free
  • it costs some CPU time
  • each thread takes memory
  • threads are not the right way to do concurrency

The solution for efficient concurrency is thus to use the event model and use callbacks. And JavaScript has that event model architecture.

Node.js Design Goals

  • no function should perform direct I/O
  • low-level (stream everything, never forced to buffer)
  • built-in support for the most important protocols (TCP, DNS, HTTP)
  • support many HTTP features (e.g. chunked requests and responses, keep-alive)
  • friendly/intuitive API
  • platform-independent

So the node.js project promotes a purely evented, non-blocking infrastructure to script highly concurrent programs. Its only dependency: python.

Here is some sample code taken from the node.js website:

Advertisements

Got a comment?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: