简体   繁体   中英

Slow deployment for a large Rails 3 application using Ruby 1.9.2

There are three problems.

  1. As with rake running capistrano tasks is painfully slow. We need to do several things on each deploy, like restarting DelayedJob, making sure Thinking Sphinx is up to date, etc... I've read there is a problem with Ruby 1.9 in terms of having to check all paths on each require and this will hopefully be fixed soon. But are there any workarounds for cap deploy?

  2. Passenger instances are slow to start up as well, probably same Ruby 1.9 path problem but are there any workarounds?

  3. Gemfile.lock gets updated on each rake and cap call. It's always the same thing that changes. +/- net-scp

The application in question is called Open Active Democracy and is located here https://github.com/rbjarnason/open-active-democracy

3) It is most certainly Gemfile.lock that is the culprit, it takes forever to update a gemfile, and it should not need updating every time.

I'd try manually just doing a bundle install on the server and see what's going on, maybe you don't have the bundle file in a permanent location for capistrano? You could also try just adding net-scp to your Gemfile for a quick fix.

On my production server it looks like this:

user@prodmachine:/var/www/railsapp/current/.bundle# cat config 
--- 
BUNDLE_FROZEN: "1"
BUNDLE_DISABLE_SHARED_GEMS: "1"
BUNDLE_WITHOUT: development:test
BUNDLE_PATH: /var/www/railsapp/shared/bundle

2) startup time, build and install the patched 1.9.2 to get the file loading speedup goodness:

http://www.rubyinside.com/get-edge-ruby-faster-loading-ruby-1-9-2-now-4973.html

You could also install the ruby-1.9.2-p290 to get a speedup on loading files that's not quite as edgy.

When you're running a few servers with various roles, it's normal for deploys to take a while. One of my larger apps takes up to 10-15 minutes to deploy. The only thing users should notice is when passenger restarts, which takes as long as your app's environment takes to load (I don't think anything can be done about that).

The worst thing that can happen is if your internet drops out during a long deploy, which can leave things in an undesirable state. This has happened to me, which prompted me to write captivate to prevent it ever happening again...

A faster alternative could also be to use whiskey_disk , described as "embarrassingly fast deployments". It's simple and fun, and might be just what you need.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM