“In our first 20 hours of opening doors we had 50,000 users sign up, and it is only accelerating. (10,000 users joined in the first 12 hrs. 10,000 more users in the next 3 hrs. 30,000 more users in the next 5 hrs!!)”

“We started the system not knowing what to expect, with only 2 servers, but ready with backup. Facebook’s rabid userbase chewed up our 2 servers almost instantly. We doubled our capacity to catch up. And then we doubled it again. And again. And again. Oh crap – we ran out of servers!! Although iLike.com has a very healthy level of Web traffic, and even though about half of all the servers in our datacenter were sitting unused, idle, as backup capacity, we are now completely maxed out.”

“We just emailed everybody we know across over a dozen Bay Area startups, corporations, and venture firms in a desperate plea to find spare servers so we can triple our capacity for the continued onslaught. Tomorrow we are picking up over 100 servers from different companies to have them installed just to handle the weekend’s traffic. (For those who responded to our late night pleas, thank you!)”

I want to give a quick plug to O’Reilly’s Rails Cookbook by Rob Orsini. A lot of the time when trying to figure out a coding problem, I rely on google searches. Some reference books are so good that if I have a problem, I learn to go to the book first before doing a google search. The best example for me is the Pragmatic Version Control book by Mike Mason. When I have a SVN problem, I go to that book.

The Rails Cookbook has not become the first source for rails programming as has Pragmatic Version Control, but I’ve turned to it a number of times when google searches have not yielded the results I needed.

The strong point of the Rails Cookbook is its breadth. It provides a lot of examples. Two that I found very helpful were 3.17 on acts_as_tree and 6.3 on modeling relationships restfully with join models. Both these examples crystallized the solution faster for me than any found blog posts or discussion items. I’m sure there will be more examples like that.

Rails Cookbook does not go into as much depth of explanation as the recipes in Rails Recipes by Chad Fowler. But that is okay. There are more of them and most of the time I’m not reading the explanations as much as looking for code samples. In that way, Rails Cookbook is great.

There are several deployment gems out there, such as deprec, RailsMachine, SlingShot’s, and capazon. I prefer a plugin, because the library files are easier to find. I thought a wiki would be useful too to use a best-of-breed approach to aggregate recipes.

Check it out and add your own recipes to the wiki. I’ll take the best ones and add them to the plugin.

The default specs for an EC2 instance include 165GB of local storage. That storage is split between 2 partitions. The default partition (/) is 9.85GB, with the rest in /mnt, which Amazon calls their “ephemeral storage”.

One problem that I ran into is the default location for installing applications, including mysql, is the default partition. So my mysql database was initially stored in what was left of the 9.85GB on the root drive. As the database grew, it quickly started to consume all of the storage on this partition.

I recommend you change your mysql data directory to the /mnt drive.

Here is how I did it.

Step 1. Backup your database!

Step 2. Shutdown mysql

service mysqld stop

Step 3. Create a new data directory on /mnt and change

mkdir /mnt/mysql_db

Step 4. Change ownership of that directory to the same owner of your rails app

About Steve

Steve's hobby is creating rails applications that no one visits. Sites like smarkets.net, trivionomy.com, and quizical.net. He's also created a couple of rails plugins; s3cache is one, and elasticrails.com is the other. One day he hopes to create something popular so he can quit his dayjob.
He can be reached at steve.odom at gmail.com