Cloud Computing - The Buzzword of 2009
Posted by Dan Simpson about 1 year agoIt's funny how something that gains popularity in a short timeframe becomes part of every marketing pitch or press release. Furthermore, every ambiguous and new term is exploited to stretch the marketing pitch even more. My definition of cloud computing is "Taking old virtualization technology, and welding it to an interface or API to control it". That's still abiguous, but I have only been using it for 16 months. So, how will it impact you?
Businesses
If your business requires several servers for operations, then you will save money by using a cloud service provider instead of colocating your own hardware.
Developers
You have far more resources to work with, which allows more creative distributed computing solutions.
Server Administrators
You no longer have to worry about it! You can setup servers to monitor servers to monitor servers. Of course, you will always play a role here, as threats change and so do defenses.
None of the above
I'm not exactly sure how it effects the rest of you, but I will say that you may see more complicated software running on your browser, and some day you will pay service fees to use those software packages.
There is good reason for the hype, but don't let all the news get you excited; the technology has existed for some time now. Web 2.0 must have become stale.
Tags: cloud, ibm, ec2, slicehost, mosso, hype Comments: [454]Tutorial: Getting Rails running with Passenger and Nginx on Ubuntu
Posted by Dan Simpson about 1 year agoI have used EC2 and slicehost in the past, but I wanted to try something else. After some searching I came accross mosso (http://mosso.com). I quickly liked the pricing model, did some more searching. I discovered they aquired slicehost, which is what powers their Cloud Servers product. It's about half the price of slicehost, and seems to be identical. Within 5 minutes of signup I was logged in to my ubuntu 8.04 server. 30 more minutes and I had a very clean nginx+passenger server throwing out what your viewing now. Here are the basics once you have your base instance running:
Step 1: Setup
If you are starting from scratch you will want to install build tools
aptitude install build-essential
Step 2: Install Ruby Enterprise Edition
wget http://rubyforge.org/frs/download.php/55512/ruby-enterprise_1.8.6-20090421_amd64.deb
dpkg -i ruby-enterprise_1.8.6-20090421_amd64.deb
export PATH=/opt/ruby-enterprise/bin:$PATH
It's a good idea to setup your path when you login, so I recommend added the export statement above your your .bashrc or an equivalent init script.
Step 3: Install the passenger module and nginx
passenger-install-nginx-module
This may require you to install some extra software such as zlib, but it will tell you exactly how to do so if needed. The passenger install process should have given you a default server config to use, so you can just copy that and paste it in the appropriate spot in the nginx config file. I used the default install path for nginx so my conf file is in /opt/nginx/conf. Make sure that the path which it points to is where you want to install your rails app.
Step 4: Run nginx to test
/opt/nginx/sbin/nginx
Test that it's working by opening your browser and hitting the IP or your domain name that is properly resolving to the IP. If it's working, then you are golden.
Step 5: Setting up Nginx to start at boot
When installing nginx via apt, it takes the proper steps to create init scripts, passenger does not. So here is how you do that. To be continued.
Tags: passenger, rails, ruby, nginx, ubuntu, cloud Comments: [18]Passenger, CPU Hungry Rails, and EC2 - Metal To The Rescue
Posted by Dan Simpson about 1 year agoIf you are planning on running rails apps on EC2, don't even try using a small instance. Here's why:
A few weeks ago I was setting up a hosting environment for a website with high traffic needs. Since the site has a new business model, purchasing hardware to handle 7000+ requests per second (RPS) is outweighed by the cloud computing alternatives. I had used EC2 before with java web applications, and in general it's great. Once you get your first AMI's setup, and security policies flushed out, scaling is actually pretty painless. However, rails is implemented in ruby, and ruby has greater resource requirements than Java. So our initial benchmarks were way below our expectations. We utilized a small instance of our Ubuntu server with the following notable config:
- Apache with mod_rails (Passenger 2.1.2)
- Memcached
- REE
- Rails 2.3.2
At some point we decided to re-launch our AMI as a medium sized instance. The difference between small and medium is simply CPU power and cost ($0.20/hour vs $0.10/hour). We instantly noticed a 5 fold increase in performance. Ruby loves eating CPU cycles. The faster a rails process can satisfy a request, the sooner a queued requests can be processed.
200 RPS is good and all, but we needed more. So, since our app has a particular service that requires much higher traffic than the rest of the app, I decided to focus on that. Rails Metal...
For those of you who are not familiar with metal, it's a new addition to rails 2.3 and it makes use of rack to skip through processing the core of rails, which eats those CPU cycles. Here is the metal:
# Allow the metal piece to run in isolation
require(File.dirname(__FILE__) + "/../../config/environment") unless defined?(Rails)
class ItemStatus
def self.call(env)
if env["PATH_INFO"] =~ /^\/items\/(\d+)\/status/
item_id = $1
item = Rails.cache.read("items/#{item_id}")
[200, {"Content-Type" => "text/html"}, [item]]
else
[404, {"Content-Type" => "text/html"}, ["Not Found"]]
end
end
end
That's it, super simple. So what kind of performance did we see?
Concurrency Level: 100
Time taken for tests: 0.894881 seconds
Complete requests: 1000
Failed requests: 0
Write errors: 0
Total transferred: 1170000 bytes
HTML transferred: 942000 bytes
Requests per second: 1117.47 [#/sec] (mean)
Time per request: 89.488 [ms] (mean)
Time per request: 0.895 [ms] (mean, across all concurrent requests)
Transfer rate: 1276.15 [Kbytes/sec] received
A little over 1100 RPS. That's not too bad, although it's just apache bench.
So once again, don't use small instances on EC2 if you are running rails, and metal kicks ass.
Tags: ruby, rails, ec2, web, metal Comments: [6]