실습을 진행하기 전에 tps와 퍼포먼스의 개념을 정리해 보았습니다.
Transaction Per Second의 약자로 초당 트랜잭션의 수입니다. 즉 하나의 request를 보내서 response가 온 개수인 것입니다.
퍼포먼스라는 것은 단위 시간당 이 시스템이 처리해 낼 수 있는 최대 가능한 처리 건수입니다.
먼저 http 서버와 클라이언트를 만들어 보았습니다.
const http = require('http');
const PORT = 8000;
const server = http.createServer((req, res) => {
res.end("hello world");
});
server.listen(PORT);
const http = require('http');
const PORT = 8000;
const options = {
host : "localhost",
port : PORT,
path : "/"
}
const req = http.request(options, (res) => {
const data = "";
res.on('data', (chunk) =>
data += chunk;
});
res.on('end', () => {
console.log(data);
});
});
req.end();
결과
-> hello world를 출력하는 httpServer와 httpClient를 만들었습니다.
node.js로 퍼포먼스 측정을 구글에 검색해보았지만 원하는 내용을 찾을 수 없었습니다.
이번엔 웹브라우저에 hello world를 출력하는 것을 하고 다음 시간에 퍼포먼스를 측정하는 실습을 마무리하도록 하겠습니다.