开发者

using ngnix infront of node.js

I am using ngnix infront of 4 instances of node.js apps running on 1 machine (quad core)

Can any ngnix experts give me any advice on how to configure this to get the most out of the web app.

I am using connect/express frameworks on node and I think they allow smart caching etc, but I am not sure which bits to let ngnix do and which bits to let the frameworks handle. Any guidance on getting the most out of this setup will be a great h开发者_如何转开发elp, thanks.


You need to take into account that any one Node instance will use several threads, and will probably keep at least one thread occupied with I/O. So say that you run 4 instances on a quad core, that means that all 4 instances will produce blocking threads, meaning that you have at least 4 blocking threads (if you have a busy server) meaning that you will at some point block all activity for short periods.

I would suggest not starting more than (number of cores)-1 instances of Node, to be half sure that at least something always keeps moving.

I do assume that there is one blocking thread per Node instance, but I could be wrong. There could be more. But the point remains the same. The more "free" threads you start, the more "blocking" threads will be created as well.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜