Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.
like image 315
Howiecamp Avatar asked Jan 25 '11 19:01

Howiecamp


People also ask

Why is node js not scalable?

There's no really a good solution in Node for that. You can spawn multiple processes, but then you will not be able to share data between them. Without data sharing, there's no way to scale CPU efficiently, so better don't try.

Which architecture is best for Node JS?

Node. js uses the “Single Threaded Event Loop” architecture to handle multiple concurrent clients. Node. js Processing Model is based on the JavaScript event-based model along with the JavaScript callback mechanism.

What are the scalability limitations of node JS?

By avoiding all that, Node. js achieves scalability levels of over 1M concurrent connections, and over 600k concurrent websockets connections. There is, of course, the question of sharing a single thread between all clients requests, and it is a potential pitfall of writing Node. js applications.


2 Answers

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.

like image 55
david Avatar answered Oct 12 '22 09:10

david


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! :)

like image 44
petermanser Avatar answered Oct 12 '22 07:10

petermanser