Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using NodeJS for a big project [closed]

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?

like image 493
matsko Avatar asked Feb 29 '12 05:02

matsko


People also ask

Why NodeJS is not good for big projects?

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.

Is node js still relevant 2022?

Node. js development has become very popular over the last four years and continues to stand the competition in 2022 making startups worldwide choose it over other available options.

Does big companies use node js?

Here are the companies using Node. js: Netflix, NASA, Trello, PayPal, LinkedIn, Walmart, Uber, Twitter, Yahoo, eBay, GoDaddy, and got much better results.


3 Answers

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.

like image 104
bryanmac Avatar answered Oct 21 '22 19:10

bryanmac


Node.js is a very good tool to build distributed network services. What is your large scale application design is more than a question 'which tools to use'. A lot of people use node.js in a very heterogeneous way together with ruby, php, erlang, apache & nginx & HAproxy. If you don't know why you need node you probably don't need it. Possible reasons to consider node:

  • you want to share common Javascript code between server and client
  • you expect highly concurrent load (thousands to hundreds of thousands simultaneous connections per server)
  • you (or your team) is much more proficient with JavaScript than with any other available language/framework
  • if one of 7600+ modules is implementing large portion of required functionality
like image 27
Andrey Sidorov Avatar answered Oct 21 '22 19:10

Andrey Sidorov


One "issue" with NodeJS, is that building a large application requires discipline on the part of the developer / team.

This is particularly true with multiple teams within the same company. Existing frameworks are a bit loose, and different teams will come up with different approaches to solving an issue.

KrakenJS is a framework, built on top of express. It adds a layer of convention and configuration that should make it easy(er) to build large projects, involving multiple teams.

like image 13
Lenny Markus Avatar answered Oct 21 '22 17:10

Lenny Markus