8

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 :(

Mikhail Nikalyukin
  • 11,867
  • 1
  • 46
  • 70
  • Thank you for posting the bit about switching to Firefox. I thought it was my dev setup, and never thought to try a different browser. – Forrest Mar 29 '12 at 04:23
  • Let me know if you find what causes this issue. By the way on the other project all works just fine, strange! – Mikhail Nikalyukin Mar 29 '12 at 11:25

3 Answers3

8

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.

kwerle
  • 2,225
  • 22
  • 25
  • The project I'm having problems with is also a localhost.local:3000. Thanks for pointing this out. – Forrest May 13 '12 at 20:39
  • 3
    This is the ".local" part that is causing problems. Use ".site" or ".internal" instead. See this question for more details: http://serverfault.com/questions/322747/can-a-long-etc-hosts-file-slow-dns-lookup – bsboris May 18 '12 at 14:10
2

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

bsboris
  • 639
  • 5
  • 8
  • 2
    It's help because all the stylesheets and javascript are combined into one file, while i want to use debug mode in the development environment. – Mikhail Nikalyukin Apr 25 '12 at 09:38
0

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.

Dan Williams
  • 3,769
  • 1
  • 18
  • 26