简体   繁体   English

提供静态文件(包括HTML文件)。 Nginx与Node.js. 哪一个更具可扩展性?

[英]Serving static files( including HTML files). Nginx vs Node.js. Which one is more scalable?

I'm curious if I could gain any advantage if I'll serve static HTML files using Node.js instead of Nginx. 如果我使用Node.js而不是Nginx提供静态HTML文件,我很好奇我是否能获得任何优势。 I know Nginx is written in C but does it serve files in a non-blocking fashion? 我知道Nginx是用C语言编写的,但它是否以非阻塞方式提供文件? I though Node.js can server more files(support more requests pe second) because I can write non-blocking code. 我虽然Node.js可以服务更多的文件(支持更多的请求pe秒),因为我可以编写非阻塞代码。

Both Node.js and Nginx are asynchronous (non-blocking) servers. Node.js和Nginx都是异步(非阻塞)服务器。 Nginx is definitely more well suited for serving your static files. Nginx绝对更适合提供静态文件。 However, depending on your use case, the difference may not be worth the added administration overhead. 但是,根据您的使用情况,差异可能不值得增加管理开销。 You would really have to be running a significant amount of traffic before you would notice the difference. 在你注意到差异之前,你真的必须运行大量的流量。

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

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