0

I have an application demo coming up soon and I need my development environment to be a bit faster than it currently is. I'm running a Rails 3.2.19 app with Ruby 1.9.3, Postgres, and Anvil/Pow to serve on a Apple Mac Mini (Core i5/4g ram) and need to be able to demo the application with decent response times.

In production, the app runs very fast but in development it's more sluggish and at times if I let the app sit idle and hit another URL it takes up to a minute for the app to spin up again.

I'm wondering if it's a problem with Pow and that I should instead just run a local rails s instance to spin up the environment. The main issue I'm seeing is that when the app sits idle for a while (let's say an hour or so) when I go to hit a url or resource within the app it can take up to a minute for the app to respond again.

Is there something I'm missing here that would allow me to prevent the latency?

nulltek
  • 3,247
  • 9
  • 44
  • 94

1 Answers1

1

My personal opinion is to ditch Pow and go with Unicorn or Thin or Puma but for the love of all that's good do not use the built-in, default of WEBrick :)!

I use Unicorn locally (it's also what we use on our production boxes) and my local sites are as fast or faster than production.

I started out with Pow but ran into a lot little 'issues' like you've mentioned and have been happy since switching to run Unicorn as my Rails development server.

Community
  • 1
  • 1
craig.kaminsky
  • 5,588
  • 28
  • 31
  • I like Pow/Anvil because of the .dev domains it gives you which is really nice but the performance hit is harsh. Come to find out, I didn't realize it but I already had thin in my `Gemfile`. So I did a `bundle exec thin start` and boy is it much faster than webbrick or Pow. Should I relocate the thin gem to my development group? Apparently I've had it in my main `Gemfile` as a production gem all this time and didn't realize it. Also, does thin have the issue with spindown after a while? – nulltek Sep 18 '14 at 18:43
  • Thin doesn't have to be in the development group but, I think, it's advisable to put it in that group if it is not your production server (since we use Unicorn on both, I let my gem entry for it be intermingled with the others and not in a dedicated group). For the .dev domain, which I love too, you can easily do that on your Mac. Just edit /private/etc/hosts and add this to a new line: 0.0.0.0 www.mysuperawesomelocalsite.dev – craig.kaminsky Sep 18 '14 at 18:46
  • Here's a link to setting up a virtual host on your Mac in case it helps (suited for 10.8 and 10.9): http://coolestguidesontheplanet.com/set-virtual-hosts-apache-mac-osx-10-9-mavericks-osx-10-8-mountain-lion/ – craig.kaminsky Sep 18 '14 at 18:49
  • Awesome, thanks. I've moved the gem to my development group. I assume since I'm not using it in production (I use passenger) it won't have any ill-effect when I do my next deployment to production? – nulltek Sep 18 '14 at 19:13
  • Sweet, thanks for the suggestion. I've let the app sit idle on my computer for 3 hours and came back to it. No spinup time, it loaded immediately. :) – nulltek Sep 18 '14 at 23:20
  • That's awesome! Very pleased to hear it's helped you out and have a great weekend! – craig.kaminsky Sep 19 '14 at 12:54