Grokking ExpressJS
Vote

0% completed

​

Worker Threads in Express Apps

A health check that normally answers in 2 ms took 2,924 ms on the test machine. The server was not overloaded with requests. One other request was counting prime numbers, and while it did, the server could not answer anything else.

The cause is computation too heavy to run between requests, and the remedy is a worker thread. Like streams, worker threads are not an Express feature but part of Node.js, so an Express app can use them without any extra package.

One Thread for Every Request

The slow health check at the start of this lesson comes from how Node.js runs your code

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content