简体   繁体   English

Node.js和多个查询而不会阻塞事件循环

[英]Node.js and multiple queries without blocking event loop

Consider a situation where 5000 users are there in the mongodb and in one shot for each user we need to do some computation which will query from n number of collections. 考虑一种情况,其中mongodb中有5000个用户,并且每个用户需要拍摄一张照片,我们需要进行一些计算,这些计算将从n个集合中查询。 We will do this everyday at a particular time. 我们将每天在特定时间执行此操作。 How this can be achieved this without blocking the event loop? 如何在不阻止事件循环的情况下实现这一目标?

try spawm or fork to create a child process to get what you need done and get the results 尝试使用spawm或fork创建一个子进程,以完成所需的工作并获得结果

http://nodejs.org/api/child_process.html http://nodejs.org/api/child_process.html

also watch this as a guide on how to use it 也请注意这作为如何使用它的指南

How to use parallel child processes to perform "work" on a large array? 如何使用并行子进程在大型阵列上执行“工作”?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM