4

I'm new to Rails 3. I use ruby 1.9.2 and Rails 3.0.7 and Windows 7

So, my problem

When I start a server this process last for a minute

When I try to access it from the browser (http://127.0.0.1:3000/demo/index) this page loads very long (from 1 minute and more)

I tried to turn off the antivirus, user faster_require gem... I just have no clue what to do...

Whats is the problem?

hasrthur
  • 1,410
  • 15
  • 31
  • 1
    For me, booting Webrick takes about half a minute on a pretty powerful laptop. When you try to access the page, does it take that long every time, or after refresh it loads faster? Also, provide your PC config please – bassneck May 02 '11 at 17:01
  • It loads faster after refresh My laptop: http://www.laptopsdirect.co.uk/ASUS_X50SL-AP163C_Laptop_X50SL-AP163C/version.asp#top – hasrthur May 02 '11 at 17:09
  • Ruby is notoriously slow on Windows. I would suggest either using Linux or JRuby/IronRuby – Vadim May 02 '11 at 17:16
  • Check out this answer and others in the same thread - same concepts apply: http://stackoverflow.com/questions/4736546/rails-3-osx-speed-up-console-loading-time/5071198#5071198 – Brian Deterling May 02 '11 at 18:29
  • Is it starting up the rails application that is slow, or is it every visit to the website that is slow? You can check the logfiles, where it is shown cleanly where time is spent: in the db or rendering the view. That might hint at what is taking so long. – nathanvda May 02 '11 at 19:52
  • If you are using Passenger read this: http://stackoverflow.com/questions/853532/slow-initial-server-startup-when-using-phusion-passenger-and-rails/853603#853603 – adanielyan Feb 03 '13 at 21:53

3 Answers3

2

When Rails starts up it needs to load the entire stack as well as a good chunk of your application, so this can take some time. It's not abnormal for it to take twenty to thirty seconds to get ready even on a current machine.

Generally this isn't an issue as the framework will do smaller reloads while it is running if in development mode. Anything you change in app/ or config/routes.rb will be detected and adjusted for between requests.

The first page load is always the slowest, but after that you should have a very responsive server. If not, something might be amiss configuration-wise.

tadman
  • 208,517
  • 23
  • 234
  • 262
1

Some people suggest using Mogrel instead of webrick. I'd recommend to give it a try.

bassneck
  • 4,053
  • 4
  • 24
  • 32
1

I had this problem with a non-rails project and Apache. Disabling IPv6 fixed the problem. YMMV.

Jeff Paquette
  • 7,089
  • 2
  • 31
  • 40