Up and Running at Rails Machine 0

I’ve succeeded in moving the blog over to Rails Machine. So far, it seems to be working great, with much faster page loads. I was seeing very erratic performance at Rails Playground, and it was down for more than 8 hours two nights ago. (Of course, it is one tenth the price of Rails Machine, so I wouldn’t expect the same level of performance.)

I’ve also upgraded to Mephisto 0.7.3.

This was my first experience deploying with Capistrano, and it took me a while to get everything right. All the automation Capistrano provides, especially with the railsmachine gem, is great—but for someone relatively new to the Rails world, it also adds another layer of stuff to figure out, and it obscures some of the details of what’s going on (which is a good thing when it all works, and not such a good thing when something goes wrong).

Moving to More Serious Web Hosting 1

I’ve been building web sites for almost 10 years, but I’ve only recently made the transition into more robust hosting accounts. For years, I got by with shared hosting, in which the host runs hundreds or thousands of web sites on a single server. These accounts are by far the most pervasive because they’re inexpensive (some as low as a few dollars a month, and most less than $20 per month) and they don’t burden the user with any of the complexities of server administration.

I began to outgrow shared hosting as my San Francisco Boating site, BoatingSF.com, started to become popular, and I started seeing failures because I was hitting database connection limits. I also added a feature that displays real-time boat positions, and to make this work I needed to be able to run background tasks and make socket connections. So last spring I made the leap to a virtual private server (VPS).

Virtual Private Hosts

A VPS is like having your own dedicated server, but instead of having the entire server to yourself, at a cost of at least $100/month and typically more like $200/month or even higher, you get a fraction of a physical server. Virtualization software, typically either Virtuozzo or Xen, makes the single machine appear as multiple, independent Linux boxes, one for each VPS account. Each VPS account has its own Linux installation, with its own Apache server, MySQL server, and so forth. You get root access to the (virtual) machine, so you have nearly complete control.

With this control, of course, comes more responsibility. The fact that you have root access means that not only can you change anything, you can also break anything. Depending upon the host, they may provide more or less assistance, but in general they expect you to be able to administer the server (though they will typically handle installation of the OS, MySQL, and other major applications).

Many VPS installations offer some kind of control panel as an option; cPanel and Plesk are the two most common options. These control panels give you a GUI interface, accessed via your web browser, that allows you to do most administration without knowing much about Linux or having to use a command line. The control panel makes it easy to add accounts and domains without having to know how to edit the Apache configuration file and administer user accounts. But I found that the control panel sometimes made it hard to understand what was really going on, and as I strayed from the straight and narrow there were things I couldn’t figure out how to do without getting down and dirty with Linux.

Hosting Rails

Moving to Rails added another complication. Rails hosting is a bit trickier than PHP, especially if you want the best performance and reliability. So while I left my PHP sites on my initial VPS, I got a Rails-oriented shared hosting account from Rails Playground. That’s where this blog is hosted as I write this. But I’m now preparing to work on several Rails sites, some of which I hope will have modest usage levels, and some of which will be deployed on behalf of businesses that expect high reliability. Even with this blog’s light loads, I’ve found page load times to be highly variable, sometimes extending to several seconds, and feedburner is sometimes timing out fetching the feed.

In pursuit of these goals, I decided to get another VPS account from a Rails-oriented host that I felt could provide good performance and reliability, and that would also have some help documents to guide me through the process of doing things right. My VPS for my PHP sites is at ServInt, and while they’ve been reliable and did eventually install Rails for me, they don’t really support it and certainly didn’t have much to offer in terms of advice.

I read some good reviews of Media Temple’s” Grid Server, which is sort of like shared hosting but across a large grid of machines instead of just one. They offer a Rails “container” at a reasonable price ($45/month with 256M RAM), so I gave it a try. But I quickly became disenchanted because of a few issues. First, as I read more blog posts, I discovered that the Grid was experiencing significant downtime. While it should, in theory, be more reliable than a single server, in practice it is a complicated setup that clearly is not quite mature. Second, because of the grid arrangement there’s a number of things you have to do specially, and you don’t have the level of control that a VPS solution provides. And finally, I found that they only offered a single Mongrel process for each Rails application, which is not recommended for sites that have significant load. So I decided to bail on Media Temple, even though the price was attractive. Once this solution matures a bit, it may be worth a second look.

Next, I decided to go for a solution that I was confident would be an excellent, robust Rails implementation. One of the best-known Rails hosts is TextDrive. To get beyond their shared hosting accounts, however, you’re looking at a minimum of $100/month, and they are not VPS accounts, so some of the things I want to do may be problematic. Engine Yard is another high-end host that seems to really know what it is doing when it comes to serious Rails performance, but their packages start at $250/month.

My Answer: Rails Machine

In the end, I decided to go with Rails Machine. At $75/month for their basic VPS account, it was about double the price of Media Temple’s Rails container, with similar specs, but I was a lot more confident about how it would perform. Rails Machine is a relatively new company that is focused on simple, robust Rails hosting. It is run by Bradley Taylor, who is the author of mongrel_cluster and created the railsmachine gem to streamline deployment. I like the idea of having this kind of talent at the hosting company—especially at a company small enough that Bradley answers support requests personally.

In the next couple weeks, I hope to have this blog switched over to Rails Machine. This is not a control-panel environment, so after 30 years in computing without significant Linux experience, I’m climbing up that learning curve. Much of the available hosting administration reference material assumes that you already know your way around Linux pretty well. And the Linux administration books typically aren’t oriented toward remote administration of an already configured machine and have lots of detail that you don’t need to know. The knowledge you need is spread across a dozen books and sites, with each containing lots of information you don’t need and none covering the whole spectrum of information you do need. But since I have time now to dive into this learning process, it’s a fun challenge.

I’ll be following up with a series of posts on what I’ve learned along the way, in the hope that I might be able to simplify the process for others.