2014-09-03 15 views
5

我有一個Ruby on Rails應用程序有以下版本:由於面臨性能問題的Rails應用程序到機架::鎖定

紅寶石:1.9.3-p547

的Rails:3.2.16

我在這個應用程序中遇到了一些性能問題。我最初的診斷工作使我着手使用文章http://www.codinginthecrease.com/news_article/show/137153中提到的RackTimer gem(https://github.com/joelhegg/rack_timer)來記錄中間件時間戳。

使用它我發現Rack :: Lock會消耗很多時間。以下 是一些從日誌下面提供的RackTimer日誌:10毫秒之間

Rack Timer (incoming) -- Rack::Lock: 73.77910614013672 ms 
    Rack Timer (incoming) -- Rack::Lock: 67.05522537231445 ms 
    Rack Timer (incoming) -- Rack::Lock: 87.3713493347168 ms 
    Rack Timer (incoming) -- Rack::Lock: 59.815168380737305 ms 
    Rack Timer (incoming) -- Rack::Lock: 55.583953857421875 ms 
    Rack Timer (incoming) -- Rack::Lock: 111.56821250915527 ms 
    Rack Timer (incoming) -- Rack::Lock: 119.28486824035645 ms 
    Rack Timer (incoming) -- Rack::Lock: 69.2741870880127 ms 
    Rack Timer (incoming) -- Rack::Lock: 75.4690170288086 ms 
    Rack Timer (incoming) -- Rack::Lock: 86.68923377990723 ms 
    Rack Timer (incoming) -- Rack::Lock: 113.18349838256836 ms 
    Rack Timer (incoming) -- Rack::Lock: 116.78934097290039 ms 
    Rack Timer (incoming) -- Rack::Lock: 118.49355697631836 ms 
    Rack Timer (incoming) -- Rack::Lock: 132.1699619293213 ms 

如可以看到的機架::鎖定中間件處理時間波動到以上,130秒。 其中大部分在我的主頁上提供資產時出現。

BTW我已經在我的config/application.rb中啓用資產管道

# Enable the asset pipeline 
    config.assets.enabled = true 

我有我的生產版本的應用程序配置爲通過NewRelic.There太圖形,圖表亮點最高%和不斷的監控由Rack :: Lock拍攝。

我完全空白什麼是造成Rack :: Lock做出這麼多毫秒的貢獻。如果來自社區的任何人都能提供他們的有價值的指導,找出可能造成這種情況以及如何解決這個問題,

下面可以找到Gemfile,所有中間件都涉及什麼和Dev環境日誌。

的Gemfile:

https://gist.github.com/JigneshGohel-BoTreeConsulting/1b10977de58d09452e19

中間件參與方式:

https://gist.github.com/JigneshGohel-BoTreeConsulting/91c004686de21bd6ebc1

開發環境日誌:

-----第一次加載主頁INDEX PAGE

https://gist.github.com/JigneshGohel-BoTreeConsulting/990fab655f156a920131

-----第二次加載主頁INDEX PAGE無需重新啓動服務器

https://gist.github.com/JigneshGohel-BoTreeConsulting/f5233302c955e3b31e2f

謝謝, Jignesh

回答

相關問題