PSGI:这是什么,有什么大惊小怪的? [英] PSGI: What is it and what's the fuss about?

查看:138
本文介绍了PSGI:这是什么,有什么大惊小怪的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试确定我的Web项目是否适合使用PSGI实施,但是在此阶段,我真的看不到对我的应用有什么好处.

I have been trying to decide if my web project is a candidate for implementation using PSGI, but I don't really see what good it would do for my application at this stage.

我不太了解所有大惊小怪的事情.在我看来,PSGI似乎是一个框架,在不同的Apache模块之间提供了一个通用接口,使您可以在它们之间移动应用程序.例如,轻松地将您的应用程序从在mod_perl上运行迁移到fastcgi,并为在这两个选项上运行提供应用程序支持.

I don't really understand all the fuss. To me PSGI seems like a framework that provides a common interface between different Apache modules which lets you move your application between them. e.g Easily move your application from running on mod_perl to fastcgi, and provide the application support for running on both options.

是对的,还是我错过了什么?

Is that right, or have I missed something?

作为我和团队的一员,我不仅参与开发应用程序,而且还参与服务器的维护和设置工作,但我认为能够在fastcgi,cgi和mod_perl上运行对我们没有任何价值,我们只需使用mod_perl就可以了.

As I and the team I am a part of not only develop the application, but also pretty much do maintenance and setup of servers I don't see the value for us of being able to run on fastcgi, cgi, and mod_perl, we do just fine with just mod_perl.

我误解了PSGI功能,还是不适合我的项目?

Have I misunderstood the PSGI functionality, or is it just not suitable for my project?

推荐答案

忘记Apache位.这是一种编写应用程序的方式,因此对Web服务器的选择不再那么重要.在$ work下,在升级到Apache2后发现我们的应用程序以非常高的CPU负载运行后,我们切换到Plack/PSGI-对各种Apache配置进行基准测试,NYTProf'ing无法确定原因,并且使用PSGI和Starman网络服务器的工作情况要好得多为我们.

Forget the Apache bit. It's a way of writing your application so that the choice of webserver becomes less relevant. At $work we switched to Plack/PSGI after finding our app running with very high CPU load after upgrading to Apache2 - benchmarking various Apache configs and NYTProf'ing were unable to determine the reason, and using PSGI and the Starman webserver worked out much better for us.

现在,所有事情都由我们的PSGI应用程序在一个地方处理(URL重写,静态内容,到期标头等),而不是Apache配置,因此它是a)Perl,并且b)可通过我们的标准/t/轻松测试脚本.另外,我们的测试现在正在准确测试用户看到的内容,而不仅仅是基本的应用程序本身.

Now everything is handled in one place by our PSGI app (URL re-writes, static content, expiry headers, etc) rather than Apache configuration, so it's a) Perl, and b) easily tested via our standard /t/ scripts. Also our tests are now testing exactly what a user sees, rather than just the basic app itself.

如果您对Apache和mod_perl感到满意,那么这可能与您无关,我相信其他人将能够提供更好的答案,但是对于我们来说,不必再处理与Apache相关的任何事情了这样的解脱本身.测试的简便性以及仅粘贴Data :: Dumper并查看正在发生的事情的能力,而不是与ModRewrite和朋友搏斗的能力,是一个很大的福音.

It may well not be relevant to you if you're happy with Apache and mod_perl, and I'm sure others will be able to give much better answers, but for us not having to deal with anything Apache-related again is such a relief in itself. The ease of testing, and the ability to just stick in a Data::Dumper and see what's going on rather than wrestling with ModRewrite and friends, is a great boon.

这篇关于PSGI:这是什么,有什么大惊小怪的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆