Perl benchmark between FCGI and PSGI

怎甘沉沦 提交于 2020-01-24 17:19:25

问题


What I know about the FCGI protocol is, the first time the application is called, it loads it into memory, run it, return the response to the server, finish the response but does not end the application, it keeps it running in memory, then next requests will use this compiled in memory copy of the application to process the request.

Reading about the PSGI protocol, it seems to be working the same way.

My question is, is my assumption correct, they are the same regarding the application speed to requests per second.

the confusing issue also if they work the same, why I see plackup has command line option to enable FCGI.


回答1:


You're asking for a comparison between apples and fruit. Your question doesn't make much sense.

There are various underlying mechanisms you can use to deploy a web application written in Perl.

  • It can be a standalone CGI program
  • It can run under mod_perl
  • It can run under FcGI
  • etc ...

The problem is that for each deployment mechanism you need to change the way that your program is written. This means that you need to know that you're, say, targetting mod_perl before you start writing the code. It also means that moving an application between these various deployment methods is non-trivial.

This is the problem that PSGI solves. Instead of writing a CGI app or a mod_perl app or a FCGI app, you write an app that targets the PSGI protocol. You can the deploy exactly the same app under CGI, mod_perl or FcGI (or many other deployment methods).

If you deploy your PSGI app using the FCGI handler, then it will work the same way as a FCGI app. But later on it's simple to move it to run as a mod_perl app. Or to run it as a standalone server using something like Starman.

Does that help at all?



来源:https://stackoverflow.com/questions/24982040/perl-benchmark-between-fcgi-and-psgi

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!