14

As I understand, node.js is useful for Java Script programmers, who can now develop in server-side. Besides, some Java Script code can be ported from client-side to server-side.

Are there any other advantages for node.js in comparison with other server-side technologies (Java web frameworks, RoR, Django, etc.) ?

1
  • 2
    Duplicate of many questions. Please search through top voted questions in the node.js tag. node is better in terms of performance then most but isn't quite as good as haskell/erlang. It sure beats RoR/ASP.NET/J2EE.
    – Raynos
    Jun 26, 2011 at 14:59

4 Answers 4

18

Package management

Compared to Java's Maven node.js package management system(npm) is the best ever. To me that alone should be enough to switch. The packages I recommend you to check out:

  • express
  • socket.io
  • node_redis
  • mongoose
  • everyauth

You can search for packages using http://search.npmjs.org/

Fast

node.js is very fast(event-loop non-blocking) and also has very speedy native bindings(C). For example node_redis(C binding) benchmarks:

PING: 20000 ops 46189.38 ops/sec 1/4/1.082
SET: 20000 ops 41237.11 ops/sec 0/6/1.210
GET: 20000 ops 39682.54 ops/sec 1/7/1.257
INCR: 20000 ops 40080.16 ops/sec 0/8/1.242
LPUSH: 20000 ops 41152.26 ops/sec 0/3/1.212
LRANGE (10 elements): 20000 ops 36563.07 ops/sec 1/8/1.363
LRANGE (100 elements): 20000 ops 21834.06 ops/sec 0/9/2.287

Active development/community

Ryan Dahl is working very very hard on his project. Also node.js now has active support(sponsor) from for example Joyent. The community is growing rapidly

1
11

Performance is the main advantage, node.js allocates a small heap per each connection, while other server side solutions create a (2MB) thread for each incoming connection, and of course creating a thread is much slower than allocating heap memory. Among the other advantages is the event-oriented and non-blocking nature of node.js.

3
  • yes, agree with rcode. And from a developer point of view, you wouldn't have to worry about thread synchronization or deadlocks. have to write lesser code compared to other high level languages. Compute heavy work can be written as a C++ addon.
    – user644745
    Apr 25, 2012 at 14:44
  • Don't remember writing new Runnable(){...} in the web stack. Ever :) Especially not when I was working with PHP :)
    – luigi7up
    Jan 21, 2013 at 11:23
  • What do you mean by non-blocking nature? I come from PHP background doing async AJAX calls via JQuery to service scripts in PHP returning JSON
    – prince
    Jan 26, 2014 at 8:16
5

node.js is event driven. While most other frameworks have this kind of functionality built-in as an add-on (e.g. via event machine), this is just "the way" in node.js. The thought is that an event driven architecture can lead to more scalable applications (often motivated by The C10K problem). Second, being written in JavaScript lowers the barrier to entry for most front-end developers who are already used to working with the language. In my opinion it's also pretty fun to work with, but I can't say I've deployed it for any high traffic applications. It also has the hype machine going for it. Recently I have become enamored with lift and scala but that's just my own preference.

4
  • 4
    Do you want frontend developers to be able to work with the backend too easily? Frontend developers and backend developers have quite a different mentality and approach to various things and I'm not at all convinced that making it too easy for one to work on the others' stuff is a good thing. Jun 26, 2011 at 13:34
  • I don't really buy either of the arguments I gave, but those are the two most commonly enumerated. I think V8 has some issues that are going to be problematic for node, especially the thread model. Jun 26, 2011 at 13:57
  • 5
    @ChrisMorgen @bmatheny lowering the barrier to entry is false. It's easier to pick up PHP then learn node.js. And there's nothing wrong with doing both front & back end development, any web developer should be able to do both (but specialise in one)
    – Raynos
    Jun 26, 2011 at 14:58
  • @Chris Morgan I do not think it is the mentality. You make it sound like front-end developers are lazy people are something. Most of the times the have different approach to solving problems, but that is also because the languages can not be compared at all(functional/oop compared to prototypal languages). When you can use both javascript at front/backend I think you be can more successfully create both sides...
    – Alfred
    Jun 27, 2011 at 0:21
1

As application developers it is our responsibility to Apply logic to solve problems. All problems that front-end developers have have similar counterparts in back-end development. Yes they are expressed differently, but they are fundamentally the same problems.

Node simply expresses this fact by unifying the methodologies in a discrete and rational way.

By having the back-end written in the same way, applying the same logical paths, it makes the transition far more transparent to the developer, simplifying their work

Not the answer you're looking for? Browse other questions tagged or ask your own question.