Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does Node.js perform compared to Apache?

Tags:

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?

like image 732
Gcoop Avatar asked Jul 28 '10 20:07

Gcoop


People also ask

Is node js like Apache?

A node. js web application is a full-fledged web server just like Nginx or Apache. Indeed, some projects use node. js as the front-end load balancer for other servers (including Apache).

CAN node JS replace Apache?

If you're prepared to re-write your PHP in JavaScript, then yes, Node. js can replace your Apache. If you place an Apache or NGINX instance running in reverse-proxy mode between your servers and your clients, you could handle some requests in JavaScript on Node.

What is the difference between Node and Apache?

Apache is usually used with php and mysql, and Node is used with Express and mongoDB. Apache is just a web server, you cant build a website using only apache. but you can build a website using only Node.

Is node js high performance?

js is simply ready to consistently send requests - and handle the next request without the need to wait till the file system opens and reads the file. Node. js is so performant because it operates on a single-thread event loop but also due to the use of Google's powerful V8 engine, also utilized in Chrome.


2 Answers

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.

like image 169
yfeldblum Avatar answered Oct 18 '22 07:10

yfeldblum


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.

like image 20
Tor Valamo Avatar answered Oct 18 '22 08:10

Tor Valamo