20

Is Node.js quicker and more scalable than Apache? Are there any performance figures to back up Node.js's performance for a web application over Apache?

UPDATE: Ok maybe my question (above) is confusing because I am a little confused as to how Node.js sits within a web stack. Under what circumstances should I consider using Node.js instead of a more traditional stack like PHP, MySQL and Apache - or does Node.js play it's part in this stack?

Jonas
  • 121,568
  • 97
  • 310
  • 388
Gcoop
  • 3,372
  • 4
  • 26
  • 35

2 Answers2

17

Node.js is a framework particularly well suited for writing high performance web applications without having to understand how to implement concurrency at a low level. It is a framework for writing server-side JavaScript apps using non-blocking IO: passing continuations to IO calls rather than waiting on results. Node.js provides a system API (filesystem access, network access, etc.) where all of the API calls take a continuation which the runtime will execute later with the result, rather than block and return the result to the original caller.

You can use by itself, if you like. But you might want a dedicated reverse proxy in front of Node.js: something like Apache, Nginx, LigHTTPD, etc. Or, for clustering a bigger app, you might want something like HAProxy in front of multiple running Node.js app servers.

yfeldblum
  • 65,165
  • 12
  • 129
  • 169
  • @agnoster Thank you for your comment - I have changed my answer. – yfeldblum Nov 06 '10 at 14:59
  • Thanks for your feedback! The only other comment I'd give is that for technical reasons if you want to run a reverse proxy in front of Node.js, and you're running socket.io, you'll want to bypass most of them for the websocket communication. – agnoster Nov 06 '10 at 18:21
  • 1
    What's the benefit of a reverse proxy? Is Node's server functionality intended more for light testing and less-secure/performant or is it that other stuff just has features people want that the basic node server doesn't? – Erik Reppen Feb 25 '13 at 18:32
7

There is a recent (July 28th, published 30th) Google Tech Talk about Node.js where there are a few performance numbers and where he also talks about scaling.

Tor Valamo
  • 33,261
  • 11
  • 73
  • 81