I am learning a nodejs structure and came to the event loop and request-response architecture model. As per documentation and multiple articles.as event loop process non-blocking operation and delegate blocking operation to the internal thread pool and when the thread finish operation, they prepare a response in the callback and come to the main stack where the event loop process response and send back to the client. It indicates if we have tasks that require CPU instead of db or file (I/O) operation our code will be in a blocked state(as it will take time to resolve).
If we wrap that heavy task in promise as we do in front-end javascript(the browser will take care of the executor function).
Would it be a good practice or am I looking for the wrong solution? I know it is not an I/O operation.
and one more doubt ,Main thread finish call back execution of I/O operation ,and send response to client ,does it not make process slow if there are multiple responses are prepared to send back to client as it block main thread?