멀티코어 컴퓨터를 사용 중이라면 몇 개의 워커가 시동되는 걸 볼 수 있습니다. 워커들이 서로
다른 요청을 처리하고 있음을 확인하고 싶다면 라우트 앞에 다음 미들웨어를 추가합니다.
const cluster = require(‘cluster’)
app.use((req, res, next) => {
if(cluster.isWorker)
console.log(`Worker ${cluster.worker.id} received request`)
next()
})
이제 브라우저에서 애플리케이션에 접속해보세요. 몇 차례 리로드하면서 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.