简体   繁体   English

使用Perl Dancer的应用程序生命周期是什么?

[英]What is the application life cycle using Perl Dancer?

Can someone explain the live cycle for a request in a Perl Dancer application starting from the server accepting the request. 有人可以从接受请求的服务器开始,在Perl Dancer应用程序中解释请求的生命周期。 Does the application stay in memory like FCGI or does it have to be loaded for every request? 应用程序是否像FCGI一样保留在内存中,还是必须为每个请求加载?

When using CGI, the application must be loaded with each request. 使用CGI时,必须为每个请求加载应用程序。 FCGI, like you said, will keep the application running. 如您所说,FCGI将保持应用程序运行。 Here's the lifecycle for CGI: 这是CGI的生命周期:

  1. loads the perl runtime 加载perl运行时
  2. loads necessary modules 加载必要的模块
  3. configures the application 配置应用程序
  4. sets up all routes (not just the one needed) 设置所有路线(不仅是所需路线)
  5. finds the correct route and handles the request. 找到正确的路线并处理请求。
  6. exits 退出

When using FCGI steps 1-4 are done at load time. 使用FCGI时,在加载时执行步骤1-4。 So if you are running with apache, when apache is started so is the perl runtime for your application. 因此,如果您使用apache运行,则在启动apache时,应用程序的perl运行时也将运行。 You are left with just step 5. Requests respond much faster when using FCGI. 您仅剩下步骤5。使用FCGI时,请求响应速度更快。

Nowadays, many web shared webhosts support FastCGI, it's just a matter of configuring it correctly. 如今,许多Web共享Web主机都支持FastCGI,这只是正确配置它的问题。

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

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