What are some architectural reasons to use node.js aside from scalability?
Asked Answered
A

6

17

The most common theme I read about why to use node.js is for high scalability due to it's evented, non-blocking I/O model. I'm trying to understand other non-scalability uses cases (and aside from being used as a general server-side javascript engine).

  1. Does node.js have other use cases if scalability isn't a concern of mine?
  2. If yes to #1, what are they?
  3. Is node.js usage appropriate for any particular type of application architectures? E.g. similar to how some key/value (nosql - ugh I hate that term) databases are useful other than for scalability reasons.
Aurify answered 25/1, 2011 at 19:40 Comment(0)
C
4

I think this blog posts sums it up quite well: http://debuggable.com/posts/understanding-node-js:4bd98440-45e4-4a9a-8ef7-0f7ecbdd56cb

In short (pro node.js):

  • Speed
  • Javascript (especially if you know it already)
  • Efficiency

node.js is really great. Give it a try! :)

Cardie answered 25/1, 2011 at 21:24 Comment(3)
two notes about the blog post (it's slightly dated): node 0.2.x runs well on cygwin, and with jsdom it's easy to do server side dom manipulations.Doubleness
what about use cases that are good for certain types of apps, not just cases where speed or efficiency are improved. For example would node.js be of any value to an app like stackoverflow.com?Aurify
@generalhenry: yeah I know, some things changed but the basics are still okay. @Howiecamp: no, usecases are especially were you have high traffic and where you want multi request in 1 time, so there's node.js strength - multi threading. I like to use it for long term connections, where I have to deliver data over a long time.. I hope that helps :)Cardie
D
8

My reason for trying out node is the fact that it is incredibly easy to send JSON data between the server and the client for ajax requests. If you use something like MongoDB, which stores data as JSON object too, you never have to worry about translating or parsing your data.

If your site uses a lot of ajax, and you're sending your data as JSON objects (rather than XML or plain text) then node.js will save you a fair bit of effort.

Disapprove answered 25/1, 2011 at 21:45 Comment(1)
In your use case are you using node.js as the only web server supporting your app, or just when you want better json handling?Aurify
C
4

I think this blog posts sums it up quite well: http://debuggable.com/posts/understanding-node-js:4bd98440-45e4-4a9a-8ef7-0f7ecbdd56cb

In short (pro node.js):

  • Speed
  • Javascript (especially if you know it already)
  • Efficiency

node.js is really great. Give it a try! :)

Cardie answered 25/1, 2011 at 21:24 Comment(3)
two notes about the blog post (it's slightly dated): node 0.2.x runs well on cygwin, and with jsdom it's easy to do server side dom manipulations.Doubleness
what about use cases that are good for certain types of apps, not just cases where speed or efficiency are improved. For example would node.js be of any value to an app like stackoverflow.com?Aurify
@generalhenry: yeah I know, some things changed but the basics are still okay. @Howiecamp: no, usecases are especially were you have high traffic and where you want multi request in 1 time, so there's node.js strength - multi threading. I like to use it for long term connections, where I have to deliver data over a long time.. I hope that helps :)Cardie
T
2

I can think of one reason, but its not very deep. Basically, If you are developing an RIA, your entire stack can be javascript. That might have some value.

But Ill question my own answer, namely the thought is, even if it makes the server side code more accessible to client side developers, they still need to understand how their server stack works. So there is still some learning to.

Tedder answered 25/1, 2011 at 20:5 Comment(0)
A
2

To be accurate, I think the general server-side JavaScript engine in your question would be V8, while according to its creator Node was built for "scripting network programs."

Based on many of his comments I don't believe he views it as broadly as many of us do, but recognizes where it can go. [I can't speak for anyone else--that's just my interpretation based on the writings and presentations I've seen.]

So it approaches things from a somewhat lower level, makes HTTP a first-class citizen and just happens to be really cool, which I think makes it enough of a "use case" for most of us. ;)

It does have a learning curve and isn't the most stable platform to build on due to its rapid development. I believe time will tell where it's most useful.

For now people are using it for "real-time" apps due to its lightweight, asynchronous nature, as well as general Web development, though IMO its sweet spot remains with its originally stated purpose.

Anticyclone answered 26/1, 2011 at 17:25 Comment(0)
M
1

What I like about node.js aside from non-blocking I/O model, scalability and all that "primary reasons" stuff:

  • Lightweight nature of it's framework. Basics are easy to learn.
  • Developer community building tons of useful modules and libraries on github which are expanding node.js lightweight core and it's capabilities.
  • It's really easy and fast to build server side and real-time systems (for example http or socket based) without the knowledge of complex libraries.
Magellan answered 25/1, 2011 at 22:11 Comment(1)
@HowieCamp - for example I can imagine node.js to be used for real-time updates, chat and long polling on site like stackoverflow.com.Magellan
H
1

I like to use NodeJS to write testing harness because you can write a stub/server/client really quickly. And you can drive your application, with ease. I can easily script a third party back-end server to do performance testing on my application. I also use it to drive my application. I can perform complex client server scenarios using setTimout to cause multiple events to be trigger based on any logic I want and test them at scale.

Henna answered 26/10, 2011 at 22:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.