高负载:自己的轻型 Web 服务器与 nginx 模块

发布于 2024-10-01 06:52:20 字数 131 浏览 1 评论 0原文

您认为,与 nginx + C++ 模块相比,为具有内置本机代码的高负载项目编写自己的 Web 服务器是一个好主意吗?也许生产力的提高可以忽略不计?

与解释性编程语言的使用相比,这种方法(nginx 的 С++ 模块)的安全性如何?

How do you think, is it a good idea to write own web-server for a high-loaded project with built-in native code comparing to nginx + C++ module? Probably, productivity gains will be negligible?

And what about the safety of this approach (С++ module for nginx) compare to usage of interpreted programming languages?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

天赋异禀 2024-10-08 06:52:20

不要这样做。

您最好将时间花在研究如何改进资源缓存上。研究 HTTP 的缓存控制、条件 GET、传输编码(即 gzip)和范围标头(按顺序)。

如果您使用 ORM,请调查是否可以启用持久性缓存来消除到数据库的网络跃点。

另外,研究 CDN 和缓存反向代理(例如 Varnish)的使用。

Don't do it.

Your time will be better spent investigating how you can improve the caching of your resources. Investigate HTTP's Cache-Control, conditional GET, Transfer-Encoding (ie gzip) & Range headers (in that order).

If you use ORM investigate wether you can enable persistence caching to eliminate network hops to your DB.

Also, investigate the use of a CDN and caching reverse proxy such as Varnish.

风柔一江水 2024-10-08 06:52:20

不要两者择其一(编译的 C 脚本)。 G-WAN 允许您使用简单的“#pragma link”指令混合 C 脚本和编译库,这样您就可以选择代码的哪一部分将被预编译以及哪一部分将保留在脚本中。

Don't choose and take both (compiled C scripts). G-WAN let you mix C scripts and compiled libraries with a simple '#pragma link' directive so you can choose which part of your code will be pre-compiled and which part will stay in a script.

梦与时光遇 2024-10-08 06:52:20

编写自己的安全网络服务器将是相当困难的。 nginx 经过了非常广泛的测试,并且更好地满足了安全方面的要求。速度可能不是问题(nginx 快如闪电)。如果负载过重,您仍然可以使用多个 nginx 进程。

关于编程语言:如果您确实正在处理高性能应用程序,您可能需要 C++ 模块,但在大多数情况下解释性语言将满足需求。我更喜欢解释性语言,因为开发可以更快地完成。如果它变得太慢,您仍然可以切换到 C++。

It will be quite difficult to write your own safe webserver. nginx is very extensively tested and fulfils the security aspect better. Speed is probably not a problem (nginx is lightning-fast). You can still use multiple nginx processes if the load gets to heavy.

Regarding programming language: If you are really dealing with a high-performance app, you are probably going to need a C++ module, but in most cases interpreted languages will suit the needs. I prefer interpreted languages, since development can be done much faster. If it gets too slow, you can still switch to C++.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文