LoginSignup
5
2

More than 5 years have passed since last update.

passenger 再起動のための touch tmp/restart.txt しても空振りしてないか?気になった

Posted at

passengerの再起動の動作が変わっているのか。

Release 5.0.0 beta 1 
これはパフォーマンス上の理由から passenger_stat_throttle_rate (Apache の場合は PassengerStatThrottleRate) のデフォルト値が 10 になったため。

passenger_stat_throttle_rate を 0 に設定すると、touch restart.txt 後に即座に再起動されるという従来と同じ挙動になるが、推奨しない。

http://ameblo.jp/hbnizm31/entry-11906103519.html
http://qiita.com/marsa746079/items/da6e19b8436232a8e62b
http://hakutoitoi.hatenablog.com/entry/2014/03/10/191942
https://gist.github.com/koudaiii/9af3483746352b59126e

https://www.phusionpassenger.com/documentation/Users%20guide%20Apache.html#_redeploying_restarting_the_rack_application
公式では
touch /webapps/rackapp/tmp/restart.txt
が書かれている

PassengerStatThrottleRate
https://www.phusionpassenger.com/documentation/Users%20guide%20Apache.html
この値を10(sec) から 0にしておいたら以前と同じ動きのよう。(ただし、ディスクへの負荷が心配)

Passengerのログはどこに書かれる?

http://redmine.jp/tech_note/passenger-options/
ログは Apache の error ログ(CentOS の場合は /var/log/httpd/error_log)に出力されます。

passenger がこのアプリだけ再起動した、というログはでてくれないか?
/var/log/httpd/error_log の以下を確認すればよさそう

[ 2015-08-05 15:24:39.7621 20757/7fa62662a700 age/Hel/Main.cpp:724 ]: Disconnecting long-running connections for process 25182, application /web/XXX (production)#default

passengerの状態

passenger-status コマンドで確認できる。

/web/XXX (production)#default:
App root: /web/XXX
Requests in queue: 0
* PID: 25976 Sessions: 0 Processed: 2 Uptime: 5s
CPU: 6% Memory : 31M Last used: 5s ago

アクセスするごとに Processed が増えて行く。
touch tmp/restart.txt の後のアクセスから、リセットされ0からのスタートとなっている。

対策

passenger は デフォルト設定により10sec おきに restart.txt をみていると考える。
そのため、touchしてても最悪10sec後にみられる可能性あり。
そのため、10sec まってからアクセスするが確実。
または passenger の PassengerStatThrottleRate を変える。

5
2
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
5
2