85

I'm not sure when this started, but something unusual is happening in my app (run locally on a development machine). Suddenly I am seeing messages like:

Started GET "/" for 127.0.0.1 at 2013-03-10 12:10:24 +1300
Processing by PagesController#home as HTML
  Rendered pages/home.html.erb within layouts/application (2.4ms)
Completed 200 OK in 3242ms (Views: 3241.4ms | ActiveRecord: 0.0ms)

As you can see 3 seconds to load the home page (a relatively simple page) ... We're not talking a hard page reload .. just clicking on the "home" link again from another page.

Not really sure where to start here, but this is my application.rb:

#config/boot.rb is loaded
require File.expand_path('../boot', __FILE__)

require 'rails/all'

if defined?(Bundler)
  Bundler.require(*Rails.groups(:assets => %w(development test)))
end

module Goodsounds
  class Application < Rails::Application
    config.encoding = "utf-8"
    config.filter_parameters += [:password]
    config.assets.initialize_on_precompile = false
    config.assets.enabled = true
    config.action_controller.assets_dir = "#{File.dirname(File.dirname(__FILE__))}/public"
    config.assets.version = '1.0'
    config.autoload_paths += Dir["#{Rails.root}/lib/modules"]
    config.assets.paths += Dir["#{Rails.root}/app/assets/fonts/*"]
    config.assets.precompile += %w( .svg .eot .woff .ttf ) 
  end
end

...and dev.rb:

Goodsounds::Application.configure do
  # Settings specified here will take precedence over those in config/application.rb
    Paperclip.options[:command_path] = "/usr/bin/"

    config.action_mailer.default_url_options = { :host => 'localhost:3000' }

  config.action_mailer.raise_delivery_errors = true

  # set delivery method to :smtp, :sendmail or :test
  config.action_mailer.delivery_method = :smtp

  # these options are only needed if you choose smtp delivery

  config.action_mailer.smtp_settings = { :address => "localhost", :port => 1025 }

  # In the development environment your application's code is reloaded on
  # every request. This slows down response time but is perfect for development
  # since you don't have to restart the web server when you make code changes.
  config.cache_classes = false

  # Log error messages when you accidentally call methods on nil.
  config.whiny_nils = true

  # Show full error reports and disable caching
  config.consider_all_requests_local       = true
  config.action_controller.perform_caching = false

  # Print deprecation notices to the Rails logger
  config.active_support.deprecation = :log

  # Only use best-standards-support built into browsers
  config.action_dispatch.best_standards_support = :builtin

  # Raise exception on mass assignment protection for Active Record models
  config.active_re
cord.mass_assignment_sanitizer = :strict

  # Log the query plan for queries taking more than this (works
  # with SQLite, MySQL, and PostgreSQL)
  config.active_record.auto_explain_threshold_in_seconds = 0.5

  # Do not compress assets
  config.assets.compress = false

  # Expands the lines which load the assets
  config.assets.debug = true
end

EDIT:

OK, Here is what I am seeing on new relic. Doesn't really help me though. Any thoughts?

enter image description here

enter image description here

Oh and what I learned from Chrome timeline:

Send Request - Details
Duration    0 (at 655 ms)
Resource    localhost
Request Method  GET

Receive Response - Details
Duration    0.043 ms (at 4.17 s)
Resource    localhost
Status Code 200
MIME Type   text/html

Receive Data - Details
Duration    176.329 ms (at 4.17 s)
Self Time   7.037 ms
CPU Time    176.329 ms
Aggregated Time 061.194 ms114.664 ms0.471 ms0
Resource    localhost
Encoded Data Length 303 Bytes
Used Heap Size  29.1 MB (+5.7 MB)

Finish Loading - Details
Duration    0 (at 4.35 s)
Resource    localhost

By the way I disabled the quiet_assets gem to see what I could discover in the terminal.. again.. not helpful:

Started GET "/" for 127.0.0.1 at 2013-03-10 21:46:40 +1300
Processing by PagesController#home as HTML
  Rendered pages/home.html.erb within layouts/application (43.4ms)
Completed 200 OK in 3501ms (Views: 3480.9ms | ActiveRecord: 19.4ms)


Started GET "/assets/dataTables/jquery.dataTables.bootstrap.css?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /dataTables/jquery.dataTables.bootstrap.css - 304 Not Modified (11ms)


Started GET "/assets/chosen.css?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /chosen.css - 304 Not Modified (5ms)


Started GET "/assets/select2.css?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /select2.css - 304 Not Modified (4ms)


Started GET "/assets/autocomplete.css?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /autocomplete.css - 304 Not Modified (1ms)


Started GET "/assets/branches.css?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /branches.css - 304 Not Modified (2ms)


Started GET "/assets/bubbles.css?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /bubbles.css - 304 Not Modified (1ms)


Started GET "/assets/business_show.css?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /business_show.css - 304 Not Modified (1ms)


Started GET "/assets/chunkyfive_font.css?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /chunkyfive_font.css - 304 Not Modified (1ms)


Started GET "/assets/consumer_show.css?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /consumer_show.css - 304 Not Modified (2ms)


Started GET "/assets/datatable_styling.css?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /datatable_styling.css - 304 Not Modified (1ms)


Started GET "/assets/datepicker.css?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /datepicker.css - 304 Not Modified (2ms)


Started GET "/assets/devise_links.css?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /devise_links.css - 304 Not Modified (1ms)


Started GET "/assets/dispenser_show.css?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /dispenser_show.css - 304 Not Modified (1ms)


Started GET "/assets/fonts.css?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /fonts.css - 304 Not Modified (1ms)


Started GET "/assets/forms.css?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /forms.css - 304 Not Modified (2ms)


Started GET "/assets/gmaps4rails.css?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /gmaps4rails.css - 304 Not Modified (1ms)


Started GET "/assets/jquery-ui-1.10.0.custom.css?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /jquery-ui-1.10.0.custom.css - 304 Not Modified (2ms)


Started GET "/assets/jumbotrons.css?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /jumbotrons.css - 304 Not Modified (1ms)


Started GET "/assets/layout.css?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /layout.css - 304 Not Modified (1ms)


Started GET "/assets/open_sans.css?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /open_sans.css - 304 Not Modified (2ms)


Started GET "/assets/popover.css?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /popover.css - 304 Not Modified (1ms)


Started GET "/assets/reviews.css?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /reviews.css - 304 Not Modified (1ms)


Started GET "/assets/spinner.css?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /spinner.css - 304 Not Modified (2ms)


Started GET "/assets/style_show.css?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /style_show.css - 304 Not Modified (2ms)


Started GET "/assets/style_show_reviews.css?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /style_show_reviews.css - 304 Not Modified (2ms)


Started GET "/assets/jquery.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /jquery.js - 304 Not Modified (3ms)


Started GET "/assets/jquery_ujs.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /jquery_ujs.js - 304 Not Modified (3ms)


Started GET "/assets/ui.custom.min.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /ui.custom.min.js - 304 Not Modified (1ms)


Started GET "/assets/bootstrap-transition.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /bootstrap-transition.js - 304 Not Modified (5ms)


Started GET "/assets/bootstrap-affix.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /bootstrap-affix.js - 304 Not Modified (3ms)


Started GET "/assets/bootstrap-alert.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /bootstrap-alert.js - 304 Not Modified (4ms)


Started GET "/assets/bootstrap-button.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /bootstrap-button.js - 304 Not Modified (5ms)


Started GET "/assets/bootstrap-carousel.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /bootstrap-carousel.js - 304 Not Modified (3ms)


Started GET "/assets/bootstrap-collapse.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /bootstrap-collapse.js - 304 Not Modified (3ms)


Started GET "/assets/bootstrap-dropdown.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /bootstrap-dropdown.js - 304 Not Modified (3ms)


Started GET "/assets/bootstrap-modal.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /bootstrap-modal.js - 304 Not Modified (3ms)


Started GET "/assets/bootstrap-scrollspy.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /bootstrap-scrollspy.js - 304 Not Modified (3ms)


Started GET "/assets/bootstrap-tab.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /bootstrap-tab.js - 304 Not Modified (3ms)


Started GET "/assets/bootstrap-tooltip.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /bootstrap-tooltip.js - 304 Not Modified (5ms)


Started GET "/assets/bootstrap-popover.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /bootstrap-popover.js - 304 Not Modified (52ms)


Started GET "/assets/bootstrap-typeahead.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /bootstrap-typeahead.js - 304 Not Modified (3ms)


Started GET "/assets/bootstrap.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /bootstrap.js - 304 Not Modified (13ms)


Started GET "/assets/gmaps4rails/gmaps4rails.base.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /gmaps4rails/gmaps4rails.base.js - 304 Not Modified (1ms)


Started GET "/assets/gmaps4rails/gmaps4rails.bing.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /gmaps4rails/gmaps4rails.bing.js - 304 Not Modified (2ms)


Started GET "/assets/gmaps4rails/gmaps4rails.googlemaps.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /gmaps4rails/gmaps4rails.googlemaps.js - 304 Not Modified (2ms)


Started GET "/assets/gmaps4rails/gmaps4rails.mapquest.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /gmaps4rails/gmaps4rails.mapquest.js - 304 Not Modified (2ms)


Started GET "/assets/gmaps4rails/gmaps4rails.openlayers.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /gmaps4rails/gmaps4rails.openlayers.js - 304 Not Modified (2ms)


Started GET "/assets/jqueryplugins/addresspicker.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /jqueryplugins/addresspicker.js - 304 Not Modified (2ms)


Started GET "/assets/jqueryplugins/browser_detect.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /jqueryplugins/browser_detect.js - 304 Not Modified (3ms)


Started GET "/assets/jqueryplugins/charts.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /jqueryplugins/charts.js - 304 Not Modified (2ms)


Started GET "/assets/jqueryplugins/jquery.alphanumeric.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /jqueryplugins/jquery.alphanumeric.js - 304 Not Modified (1ms)


Started GET "/assets/jqueryplugins/jquery.formrestrict.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /jqueryplugins/jquery.formrestrict.js - 304 Not Modified (2ms)


Started GET "/assets/jqueryplugins/jquery.lazyload.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /jqueryplugins/jquery.lazyload.js - 304 Not Modified (1ms)


Started GET "/assets/jqueryplugins/raty.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /jqueryplugins/raty.js - 304 Not Modified (2ms)


Started GET "/assets/dataTables/jquery.dataTables.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /dataTables/jquery.dataTables.js - 304 Not Modified (13ms)


Started GET "/assets/dataTables/jquery.dataTables.bootstrap.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /dataTables/jquery.dataTables.bootstrap.js - 304 Not Modified (63ms)


Started GET "/assets/lib/abstract-chosen.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /lib/abstract-chosen.js - 304 Not Modified (12ms)


Started GET "/assets/lib/select-parser.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /lib/select-parser.js - 304 Not Modified (12ms)


Started GET "/assets/chosen.jquery.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /chosen.jquery.js - 304 Not Modified (8ms)


Started GET "/assets/chosen-jquery.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /chosen-jquery.js - 304 Not Modified (9ms)


Started GET "/assets/select2.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /select2.js - 304 Not Modified (7ms)


Started GET "/assets/highcharts.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /highcharts.js - 304 Not Modified (1ms)

By the way, as per a suggestion on reddit I precompiled assets and ran the server. Seeing fantastic speeds:

Processing by PagesController#home as HTML
Rendered pages/home.html.erb within layouts/application (1.1ms)
Completed 200 OK in 6ms (Views: 5.4ms | ActiveRecord: 0.0ms)

Ok not sure this is providing any help or not but the major delay is happening between these two lines of code in the stack:

From: /home/funkdified/.rvm/gems/ruby-1.9.3-p392@goodsounds/gems/actionpack-3.2.13.rc1/lib/action_controller/metal/implicit_render.rb @ line 5 ActionController::ImplicitRender#send_action:

    3: def send_action(method, *args)
    4:   ret = super
 => 5:   default_render unless response_body
    6:   ret
    7: end

[2] pry(#<PagesController>)> next

MAJOR DELAY

From: /home/funkdified/.rvm/gems/ruby-1.9.3-p392@goodsounds/gems/actionpack-3.2.13.rc1/lib/action_controller/metal/implicit_render.rb @ line 6 ActionController::ImplicitRender#send_action:

    3: def send_action(method, *args)
    4:   ret = super
    5:   default_render unless response_body
 => 6:   ret
    7: end
Abram
  • 39,950
  • 26
  • 134
  • 184
  • Just a guess here but maybe you're loading loads of javascript or css which I see are not being precompiled. Any chance you could share your home view and layout or atleast snippets where you think the problem is? – foklepoint Mar 09 '13 at 23:51
  • Are you generating an excessive amount of html? View time used to be quadratic in the size of the page. The string containing the partial page was copied during each concatenation while evaluating the view templates. – joshuanapoli Mar 10 '13 at 03:57
  • No there isn't much. Perhaps 200 lines of html? How can I quantify the size for you. – Abram Mar 10 '13 at 08:38
  • There's a large gap between send request and receive response, but unfortunately Chrome timeline and New Relic don't tell me what's causing it.. Is there a way to force the server to give more details? – Abram Mar 10 '13 at 08:42
  • Hmm, have you defined something in /etc/hosts like "mysite.local" vs "mysite.localhost"? I usually will define the latter when I develop. For some reason recently I decided to run an app the former way "mysite.local", and it took 3-5 seconds per page load. Changed back to "mysite.localhost" and it went back to normal, fractions of seconds to load. – jemminger Mar 10 '13 at 16:16
  • Well, turns out this is the answer to my comment: http://stackoverflow.com/questions/13256485/subdomain-constraint-rails-3-makes-local-server-thin-so-slow – jemminger Mar 10 '13 at 16:26
  • To sanity check our setup, were you seeing these new relic logs for your dev env, or your prod env? – duhaime May 02 '23 at 02:42

5 Answers5

126

Ok, I figured it out (at long last). Without changing any of my actual assets I am now seeing this is development:

Started GET "/" for 127.0.0.1 at 2013-03-11 23:14:33 +1300
Processing by PagesController#home as HTML
Rendered pages/home.html.erb within layouts/application (1.3ms)

It turns out the delay was being caused by config.assets.debug = true inside of development.rb. Setting this to false resolves the problem.

Looks like the Rails core team debated turning this off by default, but decided against the idea. In the future I'd love to see them put something in the comment section of development.rb to tip off users of the potential for significant delays.

May I suggest the following:

# Expands the lines which load the assets 
# May cause significant delays in view rendering

Great, they heard me muttering and updated rails!

Michael Hampton
  • 9,737
  • 4
  • 55
  • 96
Abram
  • 39,950
  • 26
  • 134
  • 184
  • So I was right then, the large amount of stuff in your asset pipeline was causing the slowness :) You really do need to spend time tidying it up, it'll save you (another) headache in the future. – DaveStephens Mar 11 '13 at 13:49
  • Hey you're probably right... but for now a quick fix is what I need. There wasn't much I could change about my assets barring the extra gmaps js, but even when I stopped loading js completely I was still seeing page render times around 3 seconds... So, it was my assets, but I have a lot going on, and can't shave much off of my css. Not easily anyway! – Abram Mar 11 '13 at 19:15
  • 1
    If it is suitable for your project, you may consider using turbolinks (https://github.com/rails/turbolinks). This might mitigate the problem as assets will only be loaded on first page load and you will keep the advantage of assets debugging. – ybart Mar 12 '13 at 21:29
  • ybart, this is not ture... I'm actually using turbolinks in my app. The server still spends time rendering your entire page. I had the same issue as above, disabled config.assets.debug and back to my speedy awesomeness. – cpuguy83 Mar 19 '13 at 18:49
  • Yeah, it's good.. it'd be nice if asset debugging was only enabled if an asset had changed? – Abram Mar 19 '13 at 19:09
  • 2
    This definitely helped. A small correction though: the problem is actually caused by 'config.assets.debug = true' and changing it to false fixes it. – Ken Fehling Jan 23 '14 at 22:39
  • 1
    @Abram Thanks for sharing. Scratched my head for a while regarding this. – Anders Sep 08 '14 at 19:35
  • You have no idea how long this has been driving me crazy. Thank you so so much! – oneirois Jun 26 '15 at 16:10
  • 1
    Thanks Abram. I had this problem for about 6 months... :) – yaru Nov 19 '15 at 07:30
  • Abram, could you take a look at this issue? My app used to be fast but lately it became super slow in development. Sometimes it goes up to 5-6 sec, to get the response. Over 90% of the time is rendering the app/layout. http://stackoverflow.com/questions/35006964/weird-logs-in-rails4 – Sean Magyar Jan 29 '16 at 17:43
  • Oh I solved it with your solution. I tried with the one below from antulik and that didn't work. I have one question here though. My dev env response had been pretty fast and suddenly a few days ago became super slow. Setting this to false solved my problem, but could you guess why this problem evolves at all so suddenly? I feel this should be a slow process so having this problem without transition makes me think that I put something into my code. – Sean Magyar Jan 29 '16 at 17:53
  • 1
    This was my exact issue - CKE was killing my rendering. 60+seconds on first page load. Such a simple fix. – DNorthrup Aug 23 '17 at 05:36
  • I set config.assets.debug this to false and my rendering time was 250 and now is 590? – Kick Buttowski Feb 13 '19 at 18:44
34

The same issue has appeared for me in rails 4.1+. Abram's answer is only partially complete.

You can leave config.assets.debug = true but should disable new assets verification feature

# Adds additional error checking when serving assets at runtime.
# Checks for improperly declared sprockets dependencies.
# Raises helpful error messages.
config.assets.raise_runtime_errors = false

Solution with config.assets.debug disabled only works because it compiles assets once and assets are verified once. Assets verification is where the most of the time is spent.

Anton K
  • 557
  • 5
  • 9
  • antulik, could you chech this issue out? I tried your solution, but didn't help me. My app used to be fast but lately it became super slow in development. Sometimes it goes up to 5-6 sec, to get the response. Over 90% of the time is rendering the app/layout. http://stackoverflow.com/questions/35006964/weird-logs-in-rails4 – Sean Magyar Jan 29 '16 at 17:41
  • Oh I solved it with the solution above. Yours didn't work but don't know why. I have one question here though. My dev env response had been pretty fast and suddenly a few days ago became super slow. Setting config.assets.debug to false solved my problem, but could you guess why this problem evolves so suddenly? I feel this should be a slow process so having this problem without transition makes me think that I put something into my code. – Sean Magyar Jan 29 '16 at 17:55
8

If you're coming from rails 3.2.13 note that a bunch of people have experienced this issue and reverting to 3.2.12 seems to resolve it. You can find more info here on github.

In my case disabling config.assets.debug sped things up a little, but reverting to 3.2.12 dropped request time from around 4 seconds to around 250ms.

Sean O'Hara
  • 1,218
  • 1
  • 11
  • 19
2

Take a look at NewRelic.com - it costs, but the free trial will allow you to totally dissect your application and work out where any bottlenecks are.

Aside from New Relic run through the usual checks, e.g. when did it start? What have you changed recently? Have you upgraded Rails and/or any gems? Check out and run a few previous versions from your source control and try and work out specifically which commit caused the issue.

Does the issue happen with all browsers? Try firing up the Chrome timeline viewer and you'll be able to see if the browser is getting stuck up on a particular piece of JavaScript.

Also try switching your local dev web server to thin, does the issue persist?

Good luck!

DaveStephens
  • 1,126
  • 12
  • 16
  • Unfortunately I have changed a few things and also transferred work to a new laptop.. So, could be a few things.. doubting the laptop upgrade did it. I will get back to you with a tick once I confirm if this is a gem thing, but for now I'd rather not close this question in case anyone can shed light on my situation. – Abram Mar 10 '13 at 08:40
  • 1
    What version of Rails are you using? Also have you tried using thin as your local dev web server? Are you using source control? – DaveStephens Mar 10 '13 at 09:38
  • Hi Rails 3.2.13.rc1 ... Ruby 1.9.3 p392 ... I am using thin. Yes I am using git with bitbucket. – Abram Mar 10 '13 at 09:47
  • OK, I've not used 3.2.13.rc1, but it's a release candidate, so switch to the last production release version (3.2.12) to make sure it's not that. Have you rolled back through your commit history to see when the issue started? One thing I notice in your assets list above is you have a lot of stuff in there you're not using, you should probably clean that up (ie you're loading all of the gmaps4rails CSS when you only need one, and you appear to be doing something with chosen.query twice). – DaveStephens Mar 10 '13 at 10:08
  • Hey I really appreciate your help here. I will have a look at this again tomorrow night as you've made two good suggestions. Thanks so much and will get back to you. – Abram Mar 10 '13 at 10:11
  • Check out my latest edit re:production mode. Will get back to you this eve re:your suggestions above. – Abram Mar 10 '13 at 19:19
  • Looks like it could be something in the asset pipeline causing the slowness, or the compilation of. I'd still definitely recommend clearing out the junk that doesn't need to be loaded, as above, you have a lot of it! – DaveStephens Mar 10 '13 at 23:24
  • Hey chosen is only listed as //= require chosen-jquery in my manifest once as suggested by the chosen-rails gem. Also the gmaps4rails CSS is only included once.. the rest are js files for different online resources. – Abram Mar 11 '13 at 09:19
  • When you install gmaps4rails it sticks a folder into your assets directory. I remember reading it in the docs somewhere (can't remember where now) but it mentions clearing out the CSS you're not using. ie if you're using Google maps as your provider, it's pointless loading the bing maps CSS/JS. – DaveStephens Mar 11 '13 at 09:29
  • I have upvoted your comment.. thanks again for the help. Sorry but I think ticking it correct would be misleading! – Abram Mar 11 '13 at 10:33
1

Are you on OSX and serving via .local?

If so, gonna throw the post I found in my comments as a solution:
Subdomain constraint (Rails 3) makes local server (thin) SO SLOW

Community
  • 1
  • 1
jemminger
  • 5,133
  • 4
  • 26
  • 47