开发者

Using Node.js for long polling along with Apache

I read that Node.js is more CPU intensive than apache. However if I serve only the long polling calls using node.js and the rest using apache, does it still take up as much CPU or will it prove to be beneficial.

I intend to try this out myself but it would be helpful if someone has already done this and has opinions. 开发者_Go百科Thanks.


I read that Node.js is more CPU intensive than apache.

Where did you read that? I believe the opposite is true.

However if I serve only the long polling calls using node.js and the rest using apache, does it still take up as much CPU or will it prove to be beneficial.

The best part of node.js is that is very efficient doing things like long-polling. While Apache/PHP IO blocks. node.js does not have blocking IO.


Long polling doesn't make Node.js use much CPU. It just waits for the event to occur.


Apache (in prefork mode) spawns a process per connection. That is pretty limiting considering the number of processes you can launch and also the size of the process (~21MB). So you'll run out of the max number of processes/RAM pretty fast (whichever hits first).

With node you can easily manage tens of thousands of connections per process with a cheap linux box.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜