Sleep Better with a Proper Staging Environment

By Andre Bullet_white Posted in Business, Development Bullet_white Comments Comments

Nothing helps you sleep better at night like a staging environment that’s faithful to your production setup. That means your staging environment has the same Linux distro, same version of Ruby and gems, the same Apache and Passenger configuration, etc.

VPS not cloud

We’ve found that an inexpensive “always-on” VPS instance is better as a staging environment than a cloud instance we have to spin up and down. Why? Spinning up a cloud instance takes time. We’re more likely to actually use our staging environment if it’s as low-friction as possible to do so.

A staging environment isn’t free—you’ll spend money on the VPS, and you’ll spend time configuring and maintaining it. However, the peace of mind you’ll get is a great return on investment.

Setting up your staging environment

If setting up your staging environment is difficult, you have something to work on: a repeatable process for configuring production-like boxes. Remember, your staging environment should mimic your production environment as closely as possible. If you have a scripted process for setting up production boxes, then setting up your staging environment will be trivial.

If you’re like many organizations, however, there is no authoritative definition for production. Instead, it has evolved over time with manual tweaks and optimizations. In that case, the staging environment is a perfect opportunity to pull together a repeatable script. It doesn’t have to be automated (ours is not)—but it does need to be written down.

Staging deployments with Capistrano

We Rubyists are lucky—there are tools for just about everything. We use capistrano multistage for staging deployments. It’s straightforward to set up, and makes staging deployments completely frictionless.

You should end up with a “staging” file In your config/deploy directory, but not in your config/environments directory. You’ll use the your production environment for staging.

The unsolved staging problem: production-like load

The harder part is simulating production-like traffic on your staging server. In a perfect world, you would have holodeck for deployments. We don’t have a solution for this yet—ideas are welcome!

Previously in Developer Happiness

This is Part 4 in our Developer Happiness series. See previous articles:

Read More →


The 11" MacBook Air: like a good Linux tool

By Derek Bullet_white Posted in Development Bullet_white Comments Comments

I’ve been tuning Scout’s Apache setup lately. To start, I looked at the output of:

apachectl status

…but this only provides an instant snapshot. I wanted to watch the results over a longer period of time:

watch --interval=1 apachectl status

…but this generates a lot of output and I was only concerned with the number of idle workers. I wanted to make sure there were enough around during peak periods:

watch --interval=1 "apachectl status | grep 'idle'"

Perfect. One line of output and just the bits I cared about:

515 requests currently being processed, 143 idle workers

That’s why I love the Linux toolset: 4 single-purpose commands designed to work together.

My tools outside the terminal have come to resemble those within it. My latest update was a switch to an 11” MacBook Air as my development computer. The Air has limitations – a small screen, weak speakers, etc – but it’s perfect for the core work I do every day. Apps and files open quickly. Search is fast. At 2 lbs, there’s no burden carrying it around.

It’s easy to combine the Air with other tools when I need it to do more: an external monitor for a larger display or an Airport connected to my stereo for great sound.

Linux’s tools are usable by themselves but extendable – the 11” MacBook Air is in the same vein.

Read More →


Relentlessly Shortcut: .bashrc & Thor

By Andre Bullet_white Posted in Development Bullet_white Comments Comments

Check out the incredible shortcut Lance Armstrong takes in the above clip.

As developers, we should try to shortcut as smoothly as Lance does. You might not get cheered on quite as much—but then again, you have a lot more shortcut opportunities!

Shortcuts and Development Workflow

The quicker I can go from intent to action, the happier I am with my development workflow. Below are two tools I rely on to build shortcuts as effortlessly as possible.

An Organic, Evolving .bashrc

The best general-purpose shortcut mechanism is aliases in your .bashrc. I have one- and two-letter aliases for all my common working directories, git commands, server startups, etc.

If you want to relentlessly shortcut, you need a shortcut for creating shortcuts:

alias brc='vi ~/.bashrc;. ~/.bashrc'

All this does is load up .bashrc, and re-source it when I exit out of vi. This one command has turned my .bashrc into an organic, evolving toolbox, making whatever I’m working on easier, faster, and more fun.


For more involved scripting, I’ve recently become a fan of Thor. Thor is everything you like about Rake combined with everything you used to like about Sake:

  • a central place for your ad-hoc scripts
  • Usable system-wide
  • Write your own or install from remote repository
  • Low barrier to rolling your own.
  • Simple options parsing.

Here is the hello world of Thor, and here is a more advanced article to get the juices flowing.

Previously in Developer Happiness

This is Part 3 in our Developer Happiness series. See previous articles:

Read More →


CouchDB in production

By Derek Bullet_white Posted in Development Bullet_white Comments Comments

john p wood couchdb

John P. Wood of Signal, which offers a mobile customer engagement platform used by many top brands, recently created a couple of Scout Plugins for monitoring CouchDB. I’ve always been impressed by the team at Signal, so I was curious how they were using CouchDB in production. It turns out CouchDB is a huge part of their infrastructure – for example, one of their CouchDB databases is over 130GB in size.

John was kind enough to share his experiences with CouchDB below.

You use a number of different storage engines (MySQL, CouchDB, MongoDB, and Memcached) at Signal. Where does CouchDB fit in?

A couple of years ago we were running into performance issues with some very large MySQL tables. Queries against these tables were taking very long to run, and were causing page timeouts in our web application. At the advice of a friend who was helping us out as a consultant, we started looking at CouchDB. CouchDB views turned out to be a great fit for our problem.

A key component of our application is SMS messaging. The problematic MySQL queries we were running were collecting aggregate stats on these messages (how many messages did account A send in January of 2009, all of 2009, how many for all accounts, etc). Most of the queries were executing on past data, meaning the results of those queries would not change over time after that time period had past. So, it was simply a waste to re-calculate these numbers over and over. We considered using summary tables in MySQL to avoid this costly re-calculation, but saw them as being inflexible and difficult to maintain.

Read More →


Developer Happiness (2 of 5): Speed Up Your Tests

By Andre Bullet_white Posted in Development Bullet_white Comments Comments

Seeing your tests pass is a great feeling. Waiting a long time for it—not so much. Faster tests mean a happier developer!

Use Parallel Tests

If you’re not using parallel tests by Michael Grosser, you’re wasting time. Setup is just a few simple steps. You’ll be glad you did.

Upgrade Ruby if Possible

Another way to speed up your tests is to upgrade your project to Ruby 1.9.2. Here’s my Rails on 1.9.1 in Production: Just do it post.

Test suite under Ruby 1.8.6: real 3m57.156s

Test suite under Ruby 1.9.1: real 2m42.533s

A 31% speedup is nothing to sneeze at! If you have the ability, go Ruby 1.9.2 for faster tests.

Get an SSD for Your Development Box

As I pointed out a few weeks ago, dropping an SSD in my Macbook Pro cut my test runs in half. It’s not cheap, but if you spend your day on your computer, it’s well worth it.

Read More →


CouchDB Monitoring Plugins

By Derek Bullet_white Posted in Plugins Bullet_white Comments Comments

John Wood of Signal has released 2 plugins for monitoring CouchDB.

CouchDB Overall

couchdb overall monitoring

This plugin monitors your CouchDB installation across all databases, reporting activity across a number of metrics.

CouchDB Database

This plugin monitors a specific CouchDB database. If you have multiple databases on a server, install this plugin for each database.

Why CouchDB? Find out next week

The guys at Signal are smart dudes, so I was naturally curious where CouchDB fits into their infrastructure. Next week I’ll publish an interview with John where he explains their use case for CouchDB, which performance metrics they watch, the learning curve for CouchDB, and more.

Subscribe to our RSS feed or follow us on Twitter for the interview with John.

The Plugins

Like all Scout plugins, installing the CouchDB plugin is a button click away.

Other Database Monitoring Plugins


Older posts: 1 ... 36 37 38 39 40 ... 67