Hi All,
I'm really enjoying the dependency resolution and isolation that
Bundler provides, but I'm having some problems with very long install
times. In particular, running `bundle install` often takes several
minutes to run, most of it spent "Fetching source index for
http://rubygems.org/".
I'm wondering if I'm doing something wrong, or if not why it takes so
long and how we might improve the situation.
Here is an example workflow from a recent app I worked on:
# start with just a Gemfile in a clean environment
$ bundle -v
Bundler version 1.0.0.rc.5
$ bundle config
Settings are listed in order of priority. The top value will be used.
$ ls
Gemfile
$ cat Gemfile
source :gemcutter
gem "sinatra", "1.0"
gem "json_pure", "1.4.3"
gem "stalker", "0.4.2"
gem "sequel", "3.11.0"
gem "pg", "0.9.0"
gem "memcached", "0.19.7"
gem "rake", "0.8.7"
gem "thin", "1.2.7"
gem "uuidtools", "2.1.1"
gem "system_timer", "1.0"
gem "rack", "1.2.1"
gem "activesupport", "2.3.8"
gem "aws", "2.3.13"
gem "rest-client", "1.6.0"
gem "exceptional", "2.0.15"
gem "pony", "1.0"
gem "newrelic_rpm", "2.12.3"
gem "log4r", "1.1.8"
gem "rake", "0.8.7"
gem "warden", "0.10.7"
# install for the first time, without a lock file
$ time bundle install
Fetching source index for
http://rubygems.org/
Using rake (0.8.7)
Using activesupport (2.3.8)
Using http_connection (1.3.0)
Using uuidtools (2.1.1)
Using xml-simple (1.0.12)
Using aws (2.3.13)
Using beanstalk-client (1.1.0)
Using daemons (1.1.0)
Using eventmachine (0.12.10)
Using exceptional (2.0.15)
Using json_pure (1.4.3)
Using log4r (1.1.8)
Using mime-types (1.16)
Using polyglot (0.3.1)
Using treetop (1.4.8)
Using mail (2.2.5)
Using memcached (0.19.7)
Using newrelic_rpm (2.12.3)
Using pg (0.9.0)
Using pony (1.0)
Using rack (1.2.1)
Using rest-client (1.6.0)
Using sequel (3.11.0)
Using sinatra (1.0)
Using stalker (0.4.2)
Using system_timer (1.0)
Using thin (1.2.7)
Using warden (0.10.7)
Using bundler (1.0.0.rc.5)
Your bundle is complete! Use `bundle show [gemname]` to see where a
bundled gem is installed.
real 2m41.885s
user 1m55.330s
sys 0m37.416s
# try installing again right away
$ time bundle install
...
real 0m3.406s
user 0m2.682s
sys 0m0.677s
# add a dependency
$ echo 'gem "warden-googleapps" -v 0.1.1' >> Gemfile
# install again
$ bundle install
...
Installing warden-googleapps (0.1.1)
Using bundler (1.0.0.rc.5)
Your bundle is complete! Use `bundle show [gemname]` to see where a
bundled gem is installed.
real 2m41.358s
user 1m58.116s
sys 0m38.596s
Out of the three `bundle install`s issued above, the first and third
seem very slow, taking on the order of three minutes.
I'm especially surprised that the first one takes so long since I had
all of the required gems available locally.
I'm also surprised that the third one took so long since only 1 of the
gems (the one added by with `echo`) was not installed locally.
Am I doing something wrong that is causing these `bundle install`s to
take so long? If not, why is "Fetching source index for
http://rubygems.org/"
necessary and why does it take so long? If this is known and expected
behavior, how can I help to make Bundler faster in these cases?