简体   繁体   English

mod_perl vs mod_fastcgi

[英]mod_perl vs mod_fastcgi

I'm developing a web app in Perl with some C as necessary for some heavy duty number crunching. 我正在使用Perl开发一个带有一些C的Web应用程序,这对于一些重载数字运算来说是必要的。 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. 到目前为止我遇到的主要问题是试图决定是否应该使用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? 任何人都可以发布摘要或提供一个链接,我可以找到一些比较信息,也许一些建议与示例?

They are quite different beasts. 他们是完全不同的野兽。

mod_fastcgi (by the way, mod_fcgid is 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内部,因此您可以从代码中调整每个Web服务器旋钮,加速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 could aim 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

I would advise you to use a framework such as Catalyst that takes care of such details. 我建议你使用像Catalyst这样的框架来处理这些细节。 For most applications, it doesn't matter how the program connects to the webserver, as long as it is done in an efficient way. 对于大多数应用程序而言,只要以有效的方式完成,程序如何连接到Web服务器并不重要。 The choice between mod_perl and FastCGI should be made by the sysadmin who deploys it, not the developer. mod_perl和FastCGI之间的选择应由部署它的sysadmin而不是开发人员进行。

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 = 1080800

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

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