admin管理员组文章数量:1431033
I have a typical NestJS application and I integrated BullMQ to make use of queues for the following cases:
- Triggering emails and push notifications
- Making database reads and writes at specific dates and times (for example: updating a calendar event status).
I came across this and from what I understood, I should be going for a separate Node process or a worker thread only if there are heavy synchronous computations (parallelism). Since all of my functionalities are asynchronous and there are no "heavy computation" (no stuff like image compression or video conversion going on), should I still go for a separate process/worker? I assume this is a case of concurrency?
Also, I'm confused as to what's considered synchronous or asynchronous: let's say I have a large list of user items that I loop through and perform tasks like triggering emails to each item through Promise.map
. Is that async (concurrent) or sync (parallel)? I ask this because if I had to implement a heavy computation like image processing and wrap it in an async scope, it would still block the main thread. So would my case of looping also block the thread then?
本文标签:
版权声明:本文标题:node.js - Should I use separate processes or worker threads with BullMQ for asynchronous tasks in NestJS? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745560169a2663426.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论