Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up
for free
Python Web Application Monitoring in Mackerel
kizkoh
April 27, 2017
Technology
1
4.7k
Python Web Application Monitoring in Mackerel
kizkoh
April 27, 2017
Tweet
Share
More Decks by kizkoh
See All by kizkoh
kizkoh
1
300
kizkoh
0
330
kizkoh
1
4.6k
kizkoh
6
9.1k
Other Decks in Technology
See All in Technology
miyake
1
410
futo23
1
280
kawaguti
2
410
kanaugust
PRO
0
110
miura55
0
240
subroh0508
4
220
you
0
280
ch1aki
2
180
soracom
0
110
tomihisa
1
1.2k
viva_tweet_x
1
400
go5paopao
4
420
Featured
See All Featured
holman
448
130k
maggiecrowley
10
500
addyosmani
311
21k
malarkey
119
16k
kneath
294
39k
dotmariusz
94
5.5k
danielanewman
200
20k
morganepeng
93
14k
mojombo
358
62k
keithpitt
401
20k
sstephenson
145
12k
rocio
155
11k
Transcript
Python Web Application Monitoring in Mackerel id:kizkoh Hatena Co., Ltd.
2017-04-27 Mackerel Meetup #10 Tokyo #mackerelio
Python Web Application Application - WSGI に則ったインターフェイスを持つ
Python Web Application WSGI WSGI は Python の Web アプリケーション規格
uWSGI 高機能な WSGI 対応 Web サーバ Python(WSGI) 以外にも対応 Ruby Perl
(PSGI) PHP Java Lua
uWSGI --stats オプション[1] JSON 形式でメトリクスの出力をサポート 出力されるメトリクス Backlog (処理待ちリクエスト)、worker 数、処理リクエスト数に対応 Busy
Worker, Idle Worker 累計処理リクエスト数 mackerel-plugin-uwsgi-vassal でサポート [1] "The uWSGI Stats Server — uWSGI 2.0 documentation" http://uwsgi- docs.readthedocs.io/en/latest/StatsServer.html
uWSGI Workers
uWSGI Requests
uWSGI Listen Queue
Gunicorn シンプルな WSGI 対応 Web サーバ uWSGI と違い Python(WSGI) のみ対応
--statsd_host オプション[1] Worker の状態(busy, idle) を区別できない [1] "Settings — Gunicorn 19.7.1 documentation"" http://docs.gunicorn.org/en/stable/settings.html#statsd-host
モニタリングのために WSGI ミドルウェア作った!
WSGI Status[1] アプリケーション(WAF)の前段に置く 通過するときにメトリクスを出力する uwsgi の stats と同じフォーマットでファイルに出力 [1] "wsgi_status
0.2.5 : Python Package Index" https://pypi.python.org/pypi/wsgi_status/
Gunicorn Workers
Gunicorn Requests
Python Web Application Monitoring uWSGI 細かなメトリクスを収集できる 設定に慣れが必要、運用が難しい Gunicorn WSGI status
をミドルウェアとして挟む 設定項目が少ない、運用が簡単 uWSGI, Gunicorn 両方とも Mackerel でモニタリングできる!!
mackerel-plugin-uwsgi-vassal
Enjoy Python Hack!