Node.js

What is Node.js

What are the pros and cons of Node.js?

When to use and not

What is LIBUV?


What is Node.js

Node.js is a Javascript runtime environment built on V8 engine. The feature of Node.js is ..

  • Asynchronous event driven.
  • Non blocking I/O.
  • Single Thread.

Asynchronous event driven.

What are the pros and cons of Node.js?

Pros

  • Ability to handle thousands of concurrent connections with minimal overhead on a single process.

Using a technique known as "long-polling", you can write an application that sends updates to the user in real time. Doing long polling on many of the web's giants, like Ruby on Rails or Django, would create immense load on the server, because each active client eats up one server process. This situation amounts to a tarpit attack. When you use something like Node.js, the server has no need of maintaining separate threads for each open connection.

Cons

  • Huge computation could stop process even if it is asynchronous since it is single thread.
    • Using child process, we can avoid this. By default, node.js uses single CPU core.

Why is node.js not suitable for heavy CPU apps?

Node.js and CPU intensive requests

How to decide when to use Node.js?
https://medium.com/the-node-js-collection/why-the-hell-would-you-use-node-js-4b053b94ab8e


When to use and not

Use it when

you build high traction or real time application such as

  • chat application
  • log server
  • analytics tool
  • Streaming Servers

Not use when

you need heavy CPU consuming which might block stack. Since node.js engine is single thread, It is good at handling huge amount of requests but not good at huge time consuming operation.


What is LIBUV?

LIBUV is a multi-platform support library with a focus on asynchronous I/O. It uses multi-thread on Kernel, which means still node.js engine itself is single thread.

Nodejs Event Loop


https://www.youtube.com/watch?v=w1IzRF6AkuI

https://medium.com/@vigowebs/frequently-asked-node-js-interview-questions-and-answers-b74fa1f20678

https://github.com/sindresorhus/awesome-nodejs

http://visionmedia.github.io/masteringnode/

https://nodeschool.io/ja/

https://github.com/maxogden/art-of-node/#the-art-of-node

https://www.journaldev.com/7462/node-js-architecture-single-threaded-event-loop

https://www.youtube.com/watch?v=XL-nCvj2DO0

Best Practice

node best practices

https://devcenter.heroku.com/articles/node-best-practices

results matching ""

    No results matching ""