Benchmarking for capistrano tasks
Switch branches/tags
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



Getting more timing data about your capistrano-tasks. Out of the box, capistrano does include some timing data, particularly for local and remote commands, but not for tasks as a whole.

capistrano-benchmark aims to provide a quick and dirty way to do this.


You know the drill:

gem install capistrano-benchmark


You can either set this up on a per project basis, or globally on a system.

# Project-specific -- config/deploy.rb
require 'capistrano-benchmark'

# Global system -- ~/.caprc
require 'capistrano-benchmark'

Timing data isn't showed by default, and respects the ':benchmark' variable. There's a convience task for toggling this:

cap production benchmark deploy

If you want this to happen always, you can set this variable yourself:

# config/deploy.rb
set :benchmark, true

If you want to see a summarized benchmark report printed at the end:

# config/deploy.rb
after "deploy", "benchmark:report"

Implementation notes

`apistrano-benchmark works by alias chaining Capistrano::Configuration's execute_task to use ruby's built in `Benchmark` to time how long a real task works. Quick and dirty, but it gets the job done.

This is the same pattern as rails's alias_method_chain, so ideally this wouldn't really interfer with anything.

Contributing to capistrano-benchmark

  • Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet

  • Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it

  • Fork the project

  • Start a feature/bugfix branch

  • Commit and push until you are happy with your contribution

  • Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.

  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.


Copyright © 2011 Josh Nichols. See LICENSE.txt for further details.