New Relic
自作家計簿にNew Relicを導入した.
New RelicはRailsのPerformance Managemerで,PhotoShareでも有名な増井氏のblogで知った.
# masuidrive on railsはRails以外にIKEA HACK的な記事などもあって,読み物としても非常に面白い.
ローカルで開発しているときは気にならなくても,海外VPSにデプロイしてから遅さを感じることが多々あって,それがネットワークに起因するものなのかリソース(と言うかコードの効率)に起因するものなのかを切り分けたかったから.
と言うことで,増井氏が記事にされたdevelopment環境でなく,production環境の測定をLite版で.
導入手法は動画で丁寧に解説されているので,簡単.
設定ファイル(= newrelic.yml)もほとんど弄らずに使用.

New Relic RPM Lite
管理ページよりスクリーンショットを何枚か.
メニューを見ると,Lite版はOverviewとController,Apdexの3種類に制限されてるのがわかる.

New Relic RPM -Overview-
OverviewはレスポンスやだけでなくCPUやメモリの状況なども見れる.
本来はBronze版でしかみれないAR Activityもグラフだけは見ることができるみたい.
# もちろん,Webのグラフに反映されるまで若干のタイムラグはある.

New Relic RPM -Controller-
Controllerのアクション別に実行時間を見れる.
便利.
# 今のところ,予想に反した部分で時間を食ってなくてよかった…

New Relic RPM -Apdex-
ApdexってのはNew Relicを使うまで知らなかったんだけど,
ユーザの各操作に対する待ち時間を基に算出する満足度指数らしい.
Apdex is an industry standard for measuring how satisfied the user of an application or service is. It’s a simplified SLA (service level agreement) solution that gives application owners better insight into how satisfied users are vs. traditional metrics like average response time, which can be skewed by a few very long responses. Here’s how Apdex works. The application owner defines a response time threshold called T (you can define this value in your newrelic.yml file ). All responses handled in T or less time satisfy the user. For example, if T is 1.2 seconds and a response completes in 0.5 seconds, then the user was satisfied. All other responses dissatisfy the user, however there are two levels of dissatisfaction. Responses greater than T and less than or equal to 4T are tolerated by the user. Responses greater than 4T frustrate the user.
The Apdex score for an application is computed with a simple formula that returns a satisfaction ratio. A score of 1.0 means all responses were satisfactory. A score of 0.0 means none of the responses were satisfactory. Tolerating responses half satisfy a user. For example, if all responses are tolerating then the Apdex score would be 0.50.
via: New Relic RPM – Apdex (bellonieta.net(passenger:Bookkeeping))
今のところ,0.9で非常に満足度が高いということで一安心.
production環境にチューニングのための処理があるのは本末転倒な気がしないでもないんだけど,
体感ではほとんど変わらなかった.
# どんな処理をしているか,もうちょっと調べてみる必要はありそう.
こういうのは公開前に施しておくべき,エンジニアのいわゆるマナーの一種だと思うので,試せて本当に良かったと思う.
