不久前我偶然发现了 node.js,我很喜欢它。但很快我就发现它严重缺乏执行 CPU 密集型任务的能力。因此,我开始在谷歌上搜索并得到了这些解决问题的答案: 纤维、网络工作者和线程(thread-a-gogo)。现在使用哪一个是一个困惑,其中一个肯定需要使用-毕竟是什么目的有一个服务器,只是在 IO 好,没有其他?需要建议!
更新:
I was thinking of a way off-late; just needing suggestions over it. Now, what I thought of was this: Let's have some threads (using thread_a_gogo or maybe webworkers). Now, when we need more of them, we can create more. But there will be some limit over the creation process. (not implied by the system but probably because of overhead). Now, when we exceed the limit, we can fork a new node, and start creating threads over it. This way, it can go on till we reach some limit (after all, processes too have a big overhead). When this limit is reached, we start queuing tasks. Whenever a thread becomes free, it will be assigned a new task. This way, it can go on smoothly.
我就是这么想的。这个主意好吗?我对所有这些过程和线程的东西都有点新,所以在这方面没有任何专业知识。请分享你的观点。
谢谢