gpt4 book ai didi

apache - 使用 FastCGI 在 Apache 之外运行 Plack PSGI Perl 应用程序的最佳方式?

转载 作者:行者123 更新时间:2023-12-01 05:12:07 25 4
gpt4 key购买 nike

我目前正在使用 Plack::Handler::Apache2 调用的 PSGI 应用程序运行 Apache/mod_perl。我们遇到的问题是每个 Apache 进程都使用到 PostgreSQL 数据库的连接,这很昂贵。为了解决这个问题,我们计划将 PSGI 应用程序与 Apache 分开运行,并让所有 Apache 进程通过 UNIX 域套接字与其通信。在我的情况下,你会推荐什么设置?

我的计划是使用 plakup 运行它:

plackup -s FCGI -E production --nproc 100 --daemonize --listen /tmp/myapp.sock \
/usr/local/bin/myapp.psgi

我询问了 Plack 的作者 Tatsuhiko Miyagawa,是否建议将 plackup -s FCGI 用于生产目的。他提供了以下答案:

"while it could be used for production, i usually recommend using other specialized servers such as Starman, Starlet or uwsgi. FCGI is an exception because we don't have a specific FCGI daemon other than the default Plack::Handler. We have a plan to split out FCGI out of Plack core and make that a separate installation."



现在,直到 FCGI 从 Plack 中分离出来,问题是,在 Apache 之外使用 FastCGI 运行 PSGI 应用程序的最佳方法是什么?

最佳答案

如果您坚持使用 FastCGI 协议(protocol),您可以使用 mod_fastcgi 让 Apache 连接到外部 FastCGI 服务器。和 FastCgiExternalServer指令(注意 mod_fcgid 不支持这种操作模式)。这应该适用于 Plack 内置的 FCGI 处理程序。

但正如 Tatsuhiko 所说,建议使用像 Starman 或 Starlet 这样的服务器,作为 HTTP 上的反向代理。所以你会使用 mod_proxy在 Apache 方面。使用 Apache 2.4.7,也可以 communicate over Unix domain sockets .

关于apache - 使用 FastCGI 在 Apache 之外运行 Plack PSGI Perl 应用程序的最佳方式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23968517/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com