LoginSignup
47
43

More than 5 years have passed since last update.

Passenger の再起動コマンドがいつの間にか変わっていた件について

Last updated at Posted at 2015-04-23

発端

僕が仕事で Rails アプリケーションを動かす際によくお世話になっている Phusion Passenger (with Nginx) 。

最近、新しい Rails アプリケーションのために Capistrano でのデプロイ設定を行っていた時のこと。
Capistrano (Capistrano::Passenger) が Passenger を再起動する際に実行するコマンドが
見知らぬものに変わっていることに気づきました。

従来

$ touch tmp/restart.txt

現在

$ passenger-config restart-app

今までは restart.txt という空のテキストファイルを touch して再起動していたのに、
いつの間にか別の方法に変わってる!

経緯

いつから passenger-config restart-app というコマンドが使われるようになったのか。
それを調べるため CHANGELOG の内容を追ってみました。
すると、Release 5.0.0 beta 1 の欄に以下の記述がありました。

Touching restart.txt will no longer restart your app immediately. This is because, for performance reasons, the stat throttle rate now defaults to 10. You can still get back the old behavior by setting PassengerStatThrottleRate 0 (Apache) or passenger_stat_throttle_rate 0 (Nginx), but this is not encouraged. Instead, we encourage you to use the passenger-config restart-app tool to initiate restarts, which has immediate effect.

これをざっくり訳したのが以下です。

  • 現バージョンでは restart.txt を touch してもアプリケーションは即座に再起動されない。
  • これはパフォーマンス上の理由から passenger_stat_throttle_rate (Apache の場合は PassengerStatThrottleRate) のデフォルト値が 10 になったため。
  • passenger_stat_throttle_rate を 0 に設定すると、touch restart.txt 後に即座に再起動されるという従来と同じ挙動になるが、推奨しない。
    • passenger_stat_throttle_rate は Passenger がファイルシステムを確認する間隔を設定するための項目。
    • この値が 0 の場合はリクエスト毎に restart.txt がチェックされる。
  • アプリケーションを即座に再起動したい場合は代わりに passenger-config restart-app を使うことを推奨する。

なるほど、今後は Passenger を再起動したい場合は passenger-config restart-app コマンドを利用したほうがよさそうですね。

47
43
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
47
43