Slow assets ruby 1.9.3, macos, rails 3.2

霸气de小男生 提交于 2019-12-29 06:21:27

问题


Im have a really weird issue, my assets served really slow in development(10 sec per file), thia happens only in Chrome(17.0.963.79). In Firefox all works just fine. My setup:

  • RVM
  • Ruby-1.9.3@p125
  • Rails 3.2.0
  • Mac OS 10.7.3 I have tried switch from webrick to mongrel and thin, using rails-dev-tweaks gem, set cache classes to true and false. All this didnt help, im stuck why it's work slow only in chrome and not in firefox? Also this is fresh setup of OS, maybe im missing something, thanks!

UPD. If this initial request(e.g. from new tab) all goes smooth. Request take near 2 minute only if im refreshing page. I just can't wrap my head around this issue :(


回答1:


This seems to have something to do with name resolution.

Using (chrome) and

  • localhost:3000/ -- great performance
  • 127.0.0.1:3000/ -- great performance
  • hostname.local:3000/ - Terrible performance as you describe

This is unfortunate for me, as I have an alias set up in /etc/hosts to point to 127.0.0.1 that affects how the page gets displayed. So no testing of that in chrome.




回答2:


I had the same problem. Try setting config.assets.debug = false in development.rb. It helped in my case.




回答3:


We ran into this issue and solved it through using a pow server since it resolves to port 80.

To install pow

curl get.pow.cx | sh

Here is a link to the source for the paranoid.

Hope that helps.



来源:https://stackoverflow.com/questions/9720572/slow-assets-ruby-1-9-3-macos-rails-3-2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!