I am using Capistrano to deploy web applications from Amazon EC2 instances to our staging and production servers, but finding file transfer performance is very slow compared to a direct invocation of the
# US-East to London SCP: 11.2 MB/s Capistrano: 0.7 MB/s (16x slower)
The file being transfered is a single 376MB tarball, so latency shouldn't be a big issue (compared with many small files).
The Amazon EC2 instance is in the US East region, while our staging and production servers are in London. Obviously we should expect an improvement if we migrate to the Amazon EU West (Ireland) region, and this is being planned, however initial tests show Capistrano SSH speed is still a fraction of what we can get with raw SCP.
# EU-West to London SCP: 20.1 MB/s Capistrano: 2.8 MB/s (7x slower)
I assume latency is the main variable. By moving to a closer location, we reduce the ratio of SCP to Capistrano speeds, but it's still a significant difference.
All tests done with Capistrano 2.15, Ruby 1.9 on Debian Wheezy. We usually use a VPN connection, but I removed this for all the above tests. I have also tried an alternative destination server near London on a completely different network, with similar results.
My questions then: has anyone else experienced this, and is there a way to overcome it (ssh options perhaps)? Can Capistrano be forced to invoke the scp command for this step?
I have considered upgrading to Capistrano 3, however it doesn't seem to support our workflow,
set :deploy_via, :copy (application code checked out and tested on the build server, then use Capistrano to copy the whole package, including dependencies, to the deployment server).
If this can't be resolved in Capistrano 2, I'm open to alternatives, not just Capistrano 3.
[Edit: I forgot to include my Capistrano config; all the tests above are done with a very pared down script as follows]
require 'capistrano/ext/multistage' require 'rubygems' require 'railsless-deploy' set :stages, %w(dev) set :default_stage, "dev" set :application, "Deploy Test" set :scm, :none set :repository, ".." set :deploy_via, :copy set :deploy_to, '/tmp/deploy-test' ssh_options[:paranoid] = false ssh_options[:user_known_hosts_file] = '/dev/null' set :user, 'lars' set :group, 'lars' set :use_sudo, false
server '#####.net', :app, :web, :primary => true ssh_options[:keys] = '/home/lars/.ssh/#####_rsa' ssh_options[:user] = 'lars' ssh_options[:port] = '#####'