How to have heavy processing operations done in node.js

后端 未结 3 523
轮回少年
轮回少年 2021-02-04 17:50

I have a heavy data processing operation that I need to get done per 10-12 simulatenous request. I have read that for higher level of concurrency Node.js is a good platform and

3条回答
  •  暖寄归人
    2021-02-04 18:17

    Yes it will block it, as the callback functions are executed in the main loop. It is only the asynchronously called functions which do not block the loop. It is my understanding that if you want the image processing to execute asynchronously, you will have to use a separate processes to do it.

    Note that you can write your own asynchronous process to handle it. To start you could read the answers to How to write asynchronous functions for Node.js.

    UPDATE

    how do i create a non-blocking asynchronous function in node.js? may also be worth reading. This question is actually referenced in the other one I linked, but I thought I'd include it here to for simplicity.

提交回复
热议问题