apache mod_perl 与 mod_fastcgi

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/382798/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 17:04:11  来源:igfitidea点击:

mod_perl vs mod_fastcgi

perlapachemod-perlmod-fastcgi

提问by gvkv

I'm developing a web app in Perl with some C as necessary for some heavy duty number crunching. The main problem I'm having so far is trying to decide if I should use mod-perl, mod-fastcgi or both to run my scripts because I'm having a difficult time trying to analyze the pros and cons of each mod.

我正在 Perl 中开发一个 Web 应用程序,其中包含一些 C 语言,这是一些繁重的数字运算所必需的。到目前为止,我遇到的主要问题是试图决定是否应该使用 mod-perl、mod-fastcgi 或两者来运行我的脚本,因为我很难分析每个 mod 的优缺点。

Can anyone post a summary or give a link where I can find some comparison information and perhaps some recommendations with examples?

任何人都可以发布摘要或提供一个链接,我可以在其中找到一些比较信息以及一些带有示例的建议吗?

回答by Vinko Vrsalovic

They are quite different beasts.

他们是完全不同的野兽。

mod_fastcgi (by the way, mod_fcgidis recommended) just supports the FCGI protocol to execute CGIs faster with some knobs to control how many processes will it run simutaneously and not much more.

mod_fastcgi(顺便说一下,推荐使用mod_fcgid)只支持 FCGI 协议,通过一些旋钮来更快地执行 CGI,以控制它同时运行的进程数量,而不是更多。

mod_perl, on the other hand is a platform for development of applications that exposes most Apache internals to you so you can tweak every webserver knob from your code, accelerates CGIs, and much more.

另一方面,mod_perl 是一个用于开发应用程序的平台,它向您公开大多数 Apache 内部结构,因此您可以调整代码中的每个网络服务器旋钮,加速 CGI等等

If all you wish is to run your CGIs quickly, and want to support as many hosts as possible, you should stick with supporting those two ways to run your code and probably standard CGI as well.

如果您只想快速运行 CGI,并希望支持尽可能多的主机,那么您应该坚持支持这两种方式来运行您的代码,也可能支持标准 CGI。

If you care about maximum efficiency at the cost of flexibility, you couldaim for a single platform, probably mod_perl.

如果您关心以牺牲灵活性为代价的最大效率,您可以瞄准单一平台,可能是 mod_perl。

But probably the sanest option is to run everywhere and use a framework to build the application that'll take care of using the advantages of a particular way of executing if present, like Catalyst.

但可能最明智的选择是在任何地方运行并使用框架来构建应用程序,该框架将利用特定执行方式的优势(如果存在),例如Catalyst

回答by Leon Timmermans

I would advise you to use a framework such as Catalystthat takes care of such details. For most applications, it doesn't matter how the program connects to the webserver, as long as it is done in an efficient way. The choice between mod_perl and FastCGI should be made by the sysadmin who deploys it, not the developer.

我建议您使用处理此类细节的框架,例如Catalyst。对于大多数应用程序,程序如何连接到网络服务器并不重要,只要它以有效的方式完成即可。mod_perl 和 FastCGI 之间的选择应该由部署它的系统管理员做出,而不是开发人员。

回答by Ross Attrill

Here is a site with some actual performance comparisons of mod_perl, mod_fastcgi, cgi (Perl) and a Java servlet - for a very basic script: https://sites.google.com/site/arjunwebworld/Home/programming/apache-jmeter

这是一个站点,其中包含 mod_perl、mod_fastcgi、cgi (Perl) 和 Java servlet 的一些实际性能比较 - 对于非常基本的脚本:https: //sites.google.com/site/arjunwebworld/Home/programming/apache-jmeter

In summary:

总之:

cgi - 1200+ requests per minute
mod_perl - 6000+ requests per minute (ModPerl::PerlRun only)
fast_cgi - 6000+ requests per minute
mod_perl - 6000+ requests per minute (ModPerl::Registry)
servlets - 2438 requests per minute.

There is an old thread on PerlMonks comparing mod_perl and fastcgi here: http://www.perlmonks.org/?node_id=108008

PerlMonks 上有一个旧线程比较 mod_perl 和 fastcgi 在这里:http://www.perlmonks.org/?node_id=108008