LoginSignup
1
0

More than 3 years have passed since last update.

uwsgi 補遺

Last updated at Posted at 2018-06-13

vacuum

uwsgi に vacuum オプションがある。意味は「try to remove all of the generated file/sockets」なんだそうだ(ref)。

なるほどわからん。

フラグ自体は vacuum フィールドに格納される。実際の処理は
https://github.com/unbit/uwsgi/blob/master/core/uwsgi.c#L1653
にあるように、「プロセス終了時に」「pidfile をクリンナップしたり、unix domain socket を閉じたりだとか」を実行するということだそうだ。

プロセス終了時に」という一番大事なところが書いてないから意味が分からなかった。

systemd

uwsgi は new-style daemon なのだそうだ。

しかしこれだけでは何のことやら。

詳しく調べてみた。uwsgi は、環境変数 NOTIFY_SOCKET が存在すれば、sd_notifyREADY=1 を送り込む。オンオフの設定無し。

systemd は NOTIFY_SOCKET を設定するので、systemd unit ファイル側では Type=notify にするのが良いだろう。

ini-paste-logged

一つの ini ファイルで python logging の設定まで済ませることができる。

ただし logger の設定で失敗すると、このファイルに定義されている他の設定も影響を受けて、無視されたりすることに注意。ファイル出力先のディレクトリが必要なら必ず用意しておくこと。

Workers

workersprocesses は同一。プロセス数。cheaper で起動数の調整がされる。

threadsenable-thread を自動的に有効にする。

Keep-Alive

1
0
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
1
0