Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
83
rated 0 times [  90] [ 7]  / answers: 1 / hits: 39118  / 13 Years ago, wed, february 29, 2012, 12:00:00

Is NodeJS a good framework/codebase for a large server-side application? What I am looking to develop is a large application that will require HTTP transactions (states) and large amounts of concurrent users.



From what I've read online, NodeJS is not the best tool to use when it comes to large programs. What I've come across is as follows:




  • NodeJS runs on JavaScript which runs on event loops which are not very efficient when used in bulk.

  • NodeJS may be non-blocking, but all the requests are handled within a single thread so this can cause a bit of a bottleneck when many requests are handled.

  • NodeJS is built atop its own HTTP server so future maintenance will require its own sysadmin/developer hybrid to take care of the application.

  • There isn't as much well-tested and diverse software available for NodeJS that helps you build a bigger application.



Is there something I'm missing? Is NodeJS really as powerful as it can be?


More From » node.js

 Answers
47

Is NodeJS a good framework/codebase for a large server-side application?




That question is a bit subjective but I'm including actual objective points which solve real problems when working with node in a large project.



Update after working on project for awhile:



It is best as a front end / API server which is I/O bound (most front end/api servers are). If you have backend compute needs (processing etc...) it can be paired which other technologies (C# net core, go, Java etc... worker nodes)



I created this project as a sample illustrating most points - Sane Node Development:
https://github.com/bryanmacfarlane/sanenode



NodeJS is not built atop its own http server. It's built atop the V8 chrome javascript engine and doesn't assume an http server. There is a built in http module as well as the popular express web server but there's also socket modules (as well as socket.io). It's not just an http server.



The single thread does not cause a bottleneck because all I/O is evented and asynchronous. This link explains it well: http://blog.mixu.net/2011/02/01/understanding-the-node-js-event-loop/



As far as the software module, you can search at the npm registry. Always look at how many other folks use it (downloads) and visit the github repo to see if it's actively being maintained (or is there a bunch of issue never getting attention).



Regarding large project what I've found critical for sane development is:




  1. Compile time support (and intellisense): Find issues when you compile. If you didn't think you needed this like I did when I started, you will change your mind after that first big refactor.


  2. Eliminate Callback Hell: Keep performance which is critical (noted above) but eliminate callback code. Use async / await to write linear code and keep async perf. Integrates with promises but much better than solely using promises.


  3. Tooling: Lots of options but I've found best is Typescript (ES6/7 today), VS Code (intellisense), Mocha (unit testing).


  4. Instrumentation/Logging: Getting insights into your app with tracing and instrumentation is critical.


  5. Build on well vetted frameworks: I use express as an example but that's a preference and there's others.



[#87154] Monday, February 27, 2012, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
devlin

Total Points: 474
Total Questions: 113
Total Answers: 100

Location: Sweden
Member since Fri, Apr 16, 2021
3 Years ago
devlin questions
Tue, Apr 27, 21, 00:00, 3 Years ago
Sat, Oct 31, 20, 00:00, 4 Years ago
Fri, Aug 28, 20, 00:00, 4 Years ago
;