The Adventures of Scaling: A Case Study

Patrick Lenz has started in on a case study The adventures of scaling, in four instalments, on how he made eins.de scale, improving its performance by about 60%.

The online community site was ported from 50,000 lines of PHP to 5,000 lines of Rails. It serves up over 1 million dynamic page impressions on a “good day”. This first instalment goes through their unsuitable initial setup and explains why it didn’t work, including a diagram of their configuration. As one of the article’s commenters says, “Nothing beats a shiny chart”. Looks promising. Good start. Thanks for the write up Patrick. Stay tuned.

Bruce Tate on the Rails podcast

While down in Austin for SXSW, Geoffrey Grosenbach caught up with Bruce Tate for the Ruby on Rails podcast. Bruce talks about how Rails is the catalyst behind a sea change in the development world. Download as mp3 or mp4.

A long time Java developer, earlier this year Bruce put out a book called Beyond Java which caused quite a stir.

He also just wrote an article for IBM’s developer Works about Active Record aimed at Java developers called Crossing Borders: Exploring Active Record .

Keep an eye out for his upcoming Java to Ruby book. Your boss will thank you for alerting him/her to it one day.

Rails makes headlines down under

The Australian version of ComputerWorld has a great article about how Ruby on Rails is helping Spin Technologies migrate school portal schoolseek.com.au get off .NET. Jordan Brock speaks about how fast Rails is to get started with and recommends that others get going by doing a small application first. Good advice and great to see Rails making headlines down under.

Fast Rake Task Completion for Zsh

Those of you who love running Rake tasks but don’t like typing are in for a treat. Although there’s been task completion for Rake for a while now, most of the scripts for it are painfully slow, especially with Rails’ Rakefile.

Below is a small zsh completion script that uses a cache file (named .rake_tasks) to improve the performance of your tab keystrokes.

To use, throw it in your home folder somewhere and add source $HOME/.rake_completion.zsh to your .zshrc file.

A few disclaimers: Yes, it doesn’t work with lowercase named rakefile‘s. Only barbarians use such names though, so hopefully you won’t have a problem there. And no, it doesn’t complete the other assorted arguments that the rake command can accept, frankly because I rarely use them.

Without further ado, here’s the bytes.

_rake_does_task_list_need_generating () {
  if [ ! -f .rake_tasks ]; then return 0;
  else
    accurate=$(stat -f%m .rake_tasks)
    changed=$(stat -f%m Rakefile)
    return $(expr $accurate '>=' $changed)
  fi
}

_rake () {
  if [ -f Rakefile ]; then
    if _rake_does_task_list_need_generating; then
      echo "\nGenerating .rake_tasks..." > /dev/stderr
      rake --silent --tasks | cut -d " " -f 2 > .rake_tasks
    fi
    compadd `cat .rake_tasks`
  fi
}

compdef _rake rake

(Use at your own risk. Comments and improvements welcome.)

2.5 Million Requests

In case you were wondering if Rails can scale: Eric Hodel reports that the Robot Co-op served 2,587,240 requests through their Rails applications last Saturday.

Do you have any scalability stories to share?

Capistrano 1.1

Capistrano is a utility for executing tasks in parallel across multiple remote hosts. It was formerly known as SwitchTower.

Installation:

gem install capistrano

Version 1.1 introduces a few changes:

  • The generated capistrano.rake file is simpler now than it used to be. You can easily append custom options to individual tasks now. For instance, if you want the deploy to be silent, instead of verbose, just add “-q” to the parameter list for that task.
  • The generated capistrano.rake file uses the “remote” namespace, so you’ll need to have at least Rake 0.7.0. You can still do “rake deploy” and “rake rollback”, but the other tasks must be prefixed with the namespace (“rake remote:exec”, “rake remote:show_tasks”, etc.)
  • The ‘switchtower’ command is replaced by the ‘cap’ command.
  • The cap utility is verbose by default. If you want it to be silent, use the -q option. If you want it to be less verbose, you can specify the -v or -vv flags explicitly.
  • The cap utility uses more rake-like command-line semantics. Instead of needing to do “cap -r config/deploy -a deploy”, you can just do “cap deploy”. It will look for config/deploy.rb, capfile, or Capfile automatically, and will treat raw parameters as action names.

Upgrading/switching from SwitchTower to Capistrano is a little inconvenient. Here’s what you’ll need to do:

  • gem uninstall switchtower (remove all versions)
  • gem install capistrano
  • For each of your Rails projects, do “cap -A .”, keeping your deploy.rb
  • For each of your Rails projects, remove lib/tasks/switchtower.rake

Enjoy!

SwitchTower is now Capistrano

We were served with a “cease and desist” from Raindance Communications, Inc. over the use of their registered trademark SWITCHTOWER on Friday. This led to a wild three-day brainstorming session and a new name for SwitchTower: Capistrano.

New gems and so forth will be available tomorrow, as well as updated documentation using the new name. For existing SwitchTower users, you’ll need to run cap -A . on each of your projects, once the new gems are available and installed. (cap is the new name of the switchtower utility.)

You can read all about the brainstorming process and how the new name was selected on Jamis’ blog.

Rick Olson joins the Rails core

Rick Olson aka technoweenie has been granted the rank of core and will join the new 12-strong group of developers with commit rights to the Rails source.

Rick has long been a prominent figure in the Rails community with ton of great plugins to his name, but it has been his work on Rails 1.1 that made us realize that he was an obvious fit.

From the upgraded calculations, to enumeration support for RJS, to his work on eager loading, and a ton of other minor issues, Rick has shown strong knowledge and ability across the code base. When Rails 1.1 is released shortly, you’ll be using a lot of Rick’s code.

So congratulations, Rick! You’ve joined the exclusive club of Rails core committers.

Sneak peak at effortless deployment with Rails Machine

SwitchTower author Jamis Buck has provided an excellent manual documenting how to use it. Those who’ve taken the plunge are loving how easy it makes deployment, as well as myriad other tasks. But I’m still always hearing, “We haven’t setup SwitchTower yet but are really looking forward to”.

Enter Rails Machine. It sets out to lower the barrier to using SwitchTower by taking care of all the setup and maintenance. They are scheduling to open their doors in April. For now take a look at the short movie they’ve made showing how easy they’ve made it for you to get going with SwitchTower. They get you up and running in under 5 minutes. No more excuse to not realize how much you love SwitchTower.