본문 바로가기
Node js/Node js

Node.js 란?

by Bill Lab 2025. 3. 23.
728x90

인프런 강의를 시작하면서, 보다 원론적인 것부터 설명이 필요하다는 것을 느꼈다.

(이는 실무중심의 멘토링 서비스를 제공하는 "항해플러스"의 시스템과는 상이한 부분이다.)

 

Node.js란? 결론부터 말하면

나무위키나 공식사이트를 참고하면, Node.js 는 Javascript를 브라우저 밖에서도 실행하게 해주는 런타임환경이다?라고 표현되어 있지만, Electron Framework 등 특정상황을 제외 하면, Javascript 언어로 서버환경을 구성하게 해주는 환경이다.

즉, Node.js 로 공식사이트와 같이 아래와 같은 코딩을 하게 되면 웹서버 역할로써 Node.js 가 되는 것이다.

const { createServer } = require('node:http');

const hostname = '127.0.0.1';
const port = 3000;

const server = createServer((req, res) => {
  res.statusCode = 200;
  res.setHeader('Content-Type', 'text/plain');
  res.end('Hello World');
});

server.listen(port, hostname, () => {
  console.log(`Server running at http://${hostname}:${port}/`);
});

 

 

Node.js의 탄생 배경도 알아보자

2009년 5월 27일 처음 출시 외었으며, C++ 기반인 Google의 V8엔진과 libuv를 결합하여 개발되었다.

Ryan Dahl이 Node.js를 개발하고 어파치와의 차이점을 기반으로 설명한 영상도 첨부하겠다.

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

 

 

왜 하필 V8엔진이었을까? 

지금까지도 Javascript언어에서 언급되고 있는 부분은 바로 "속도"이다.

(얼마전 Microsoft에서 Typescript 로드맵 발표에서도 바로 이 속도 때문에 Javascript를 개선해서 사용하는 방식이 아닌 C++과 함께 유사한 속도를 자랑하는 Native 언어인 Go를 이용하여 속도문제를 해결하였다.)

 

 

그럼 다른 웹서버와 비교시 차별화 되는 부분은?

영상에 보면 Ryan Dahl 이 언급하지만, 기존 웹서버(어파치)의 경우 대부분을 멀티쓰레드기반에 동기 방식이지만,

Node.js는 이벤트 기반의 비동기 방식을 기본방식으로 제공한다. 이벤트 루프(event loop)를 이용한 비동기 방식은 요청이 들어오면 해당 요청을 처리하는 스레드를 기다리지 않고 다른 작업을 계속 처리할 수 있으며, 특히 많은 동시 요청을 처리해야 하는 서버에서 뛰어난 성능을 발휘한다. 그렇기 때문에 Node.js는 I/O 작업이 많은 서버나 실시간 애플리케이션에서 매우 효과적이다.

 

 

최근 기준으로 Node.js를 사용하는 회사는 어디가 있을까?

(자바 공화국인 국내를 제외하고 말이다.)

 

1. Netflix

https://www.bellcorpstudio.com/blog/how-netflix-is-using-node-js

 

https://www.bellcorpstudio.com/blog/how-netflix-is-using-node-js

 

www.bellcorpstudio.com

 

2. LinkedIn

https://medium.com/building-with-x/building-with-node-js-at-linkedin-ae4ea6af12f2

 

Building With Node.js At LinkedIn

Deepank Gupta is a Senior Software Engineer at LinkedIn, a platform that connects the world’s professionals to make them more productive…

medium.com

 

3. Uber

https://www.uber.com/en-KR/blog/uber-tech-stack-part-two/

 

Uber Engineering's Tech Stack: The Edge and Beyond

The end of a two-part series on the tech stack that Uber Engineering uses to make transportation as reliable as running water, everywhere, for everyone, as of spring 2016.

www.uber.com

 

4. Walmart

https://medium.com/walmartglobaltech/create-slackbot-using-slack-bolt-api-and-node-js-a82876db012f

 

Create slackbot using slack bolt API and Node.js

Slack

medium.com

 

5. Paypal

6. Microsoft

 

728x90