简体   繁体   English

如何很好地关闭Perl舞者应用程序

[英]How to shutdown Perl dancer applications nicely

I run several Perl dancer applications at the same time with the same user in FCGI mode (Apache). 我在FCGI模式(Apache)中使用相同的用户同时运行多个Perl舞者应用程序。 As I understand correctly, Apache (or any other webserver) will fork a new dancer application if the current one(s) are busy. 据我所知,如果当前的应用程序繁忙,Apache(或任何其他网络服务器)将分叉一个新的舞者应用程序。

To ensure that no visitor is interrupted by the dancer shutdown I like to let dancer handles the current connection until it finished and then exit / last the process. 为了确保没有游客由舞蹈家关机我喜欢让舞者处理当前的连接,直到它完成,然后中断exit / last的过程。

How to shutdown a Perl dancer application using kill signal HUP to perfom such nice shutdown? 如何使用kill信号HUP关闭Perl舞者应用程序以实现这样的良好关闭?

To rollout a new version of a dancer application I use pkill -HUP perl as the dancer user to "shutdown" the processes. 要推出新版本的舞者应用程序,我使用pkill -HUP perl作为舞者用户来“关闭”进程。 But currently (due to missing signal handler) it's more like shoot 'em down as of shutdown an application . 但是目前(由于缺少信号处理程序),它更像是在关闭应用程序时 向下发射

The solution by mugen kenichi works ( starman ): mugen kenichi解决方案starman ):

If you are able to change your infrastructure you could try one of the plack webservers that support your need. 如果您能够更改基础架构,可以尝试一种支持您需求的plack Web服务器。 starman and hyponotoad both do graceful restarts on SIGHUP starman和hyponotoad都在SIGHUP上进行了优雅的重启

There are a few shortcoming regarding <% request.uri_base %> so we have to develop with hard coded URI paths. 关于<% request.uri_base %>存在一些缺点,因此我们必须使用硬编码的URI路径进行开发。 Not very handsome but necessary. 不是很帅但很有必要。

If I read your question correctly, you are concerned that Apache/FCGI might kill the Dancer app while it is in the middle of handling a request. 如果我正确地阅读了您的问题,您会担心Apache / FCGI在处理请求时可能会杀死Da​​ncer应用程序。 Is that correct? 那是对的吗?

If so, don't worry about it. 如果是这样,请不要担心。 Apache/FCGI doesn't do that. Apache / FCGI不这样做。 When it forks a new instance of the handler because existing ones are busy, that's a new one in addition to the existing instances. 当它分叉处理程序的新实例因为现有的处理程序繁忙时, 除了现有实例之外 ,这是一个新实例。 The existing ones are left alone to finish what they're doing. 现有的只留下来完成他们正在做的事情。

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

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