監控 Rails 中站點性能的最佳方法是什麼 (What is the best approach to monitor site performance in rails)


問題描述

監控 Rails 中站點性能的最佳方法是什麼 (What is the best approach to monitor site performance in rails)

I'd like to have a special part of administrate area which shows a list of pages/queries that was slow for the past week. 

Is there a gem / plugin or other easy way to  implement/automate such functionality for the Rails framework?

‑‑‑‑‑

參考解法

方法 1:

http://www.newrelic.com/features.html

And a short screencast for RPM:

http://railslab.newrelic.com/2009/01/22/new‑relic‑rpm

P.S. I don't work for New Relic:)

方法 2:

Here's one example, and another and yet another.  See google for even more.

方法 3:

Yeah, it seems like a nice idea. I´ve never seen it before but I imagine you could just log the time each request takes to a DB; then a simple query will show you the slowest requests.

How you optimize your app depends entirely on your code; I guess there´s no silver bullet for that.

方法 4:

First thing that comes to mind: one could track execution time of the queries and if it passes some threshold which is considered normal (average maybe) it gets logged along with some profiling information (which is discarded otherwise).

It's might also be feasible to profile individual parts of the query (like data acquisition from db, logic and so on), then again compare the times against some averages.

One pitfall is that some pages/queries are bound to be processed significantly longer then  others because of the difference in the amount of "work" they do. One would have to keep a whole lot of averages for different parts of the site / different types of queries in order to get rid of constant flow of normal queries that execute longer by design.

This is a very simple approach though, I'm sure there are better ways to do it.

(by se_pavelMarcin UrbanskiMarkusQSebSaulius Žemaitaitis)

參考文件

  1. What is the best approach to monitor site performance in rails (CC BY‑SA 3.0/4.0)

#performance #ruby-on-rails #MySQL






相關問題

為什麼 Document.html() 這麼慢? (Why is Document.html() so slow?)

Sql中的WHERE,結合兩個快速條件會成倍增加成本 (WHERE in Sql, combining two fast conditions multiplies costs many times)

Tối ưu hóa truy vấn MySQL PHP - Phản hồi (MySQL PHP Query Optimization - Feedbacks)

jGRASP 上的編譯時間很慢——為什麼? (Slow compile times on jGRASP -- why?)

Pandas - 將直方圖桶分配給每一行 (Pandas - assign histogram bucket to each row)

VB.NET 中 Dictionary(Of String, SomeReferenceType) 的性能 (Performance of Dictionary(Of String, SomeReferenceType) in VB.NET)

發送到 Web 客戶端需要多少 JSON? (How much is too much JSON to send over to a web client?)

過期/緩存控制標頭的問題 (Problem with Expires/Cache-Control Headers)

iOS UI 性能分析 (iOS UI performance profiling)

限制內存機器性能的技巧?IIS 應用程序 (Tips for limit memory machine performance? IIS application)

監控 Rails 中站點性能的最佳方法是什麼 (What is the best approach to monitor site performance in rails)

決定 HTTP 標頭的字符集。我應該簡單地把 utf-8 和 fuggedaboutit 放在一起嗎? (Deciding charset for HTTP Headers. Should i simply put utf-8 and fuggedaboutit?)







留言討論