Cobalt Edge

 
Filed under

Apache

 

Benchmarking Mongrel, Apache, Rails, etc.

I'm doing some benchmarking of a Rails based web app (technically, a web service) to try to establish some baselines and to use in assessing build outs/hardware deployment, etc. To start off, I wanted to establish a baseline by using pure static content. The performance I got didn't seem quite right to me. Below is a message I sent to the mongrel-users mailing list. I figured this was a good blog item, and would like to solicit help on this...

I'm trying to do some initial benchmarking of our setup, mainly just to establish baselines. I'm essentially using the process Zed outlines in a previous message:
http://rubyforge.org/pipermail/mongrel-users/2006-May/000200.html

What I'm running into is that Mongrel appears only half as fast as Apache when serving a small static HTML file. If I then add in Apache with mod_proxy_balancer, going to a single Mongrel, it drops down to nearly about a third of what pure static Apache will do. This seems bogus to me, and I suspect I have either some configuration problem, or something. My understanding from what I've read is that Mongrel should be fairly close to Apache when serving static content (at least not only 50% as fast). Is that right as a generalization?

Here's some info to back this up.
- Server: HP DL360 dual 3.0GHz Xeons, 4GB RAM, 10k RPM SCSI disks
- OS: Fedora Core 6, up to date as of a few days ago
- Apache 2.2.3-5, with mod_proxy_balancer
- Mongrel 1.0.1, mongrel_cluster 0.2.1
- serving a static HTML file from the Rails app's public directory
- Testing using an identical server, that sits above this one in the rack, connected to a switch (so it's one hop)
- Using httperf for testing, with the following command:
httperf --server lab05 --port 80 --uri /mongrel_alive.html --num-conns 10000
The number of connections I vary to be near the 10 second mark...

Here's the results:

- Just Apache, num-conns=15000, ~1400 req/sec
- Direct to Mongrel on port 5000, num-conns=8000, ~740 req/sec
- Apache mod_proxy_balancer to a single Mongrel, num-conns=5000, ~475 req/sec

So, I'm incurring a massive penalty for the balancer/cluster setup. In production we will be using hardware load balancers, but even still, my understanding was that instead of a drop from 1400 to 740, it should be somewhat closer (say at least over 1000).

What would folks suggest, or what comments do you have?

Shortly after that, I decided to throw Pen and Nginx in the mix just as a random check on this. I haven't used them before so relied on what I found on the net, etc. for config, thus I could potentially get better results, but they yielded:
  • Nginx with one Mongrel: ~612 req/sec
  • Pen with one Mongrel: ~670 req/sec
I can see Apache being slower than these, as it's a much bigger and more complex app. So the question remains, should straight Mongrel be half as fast as Apache? And, should the load balancers affect the performance that much (although Pen is having only a 10% impact here).

Loading mentions Retweet
Filed under  //   Apache   LoadBalancing   Mongrel   Performance   Rails   Testing  

Comments [0]

Installing Rails, Apache 2.2, and Mongrel on Ubuntu Dapper 64-bit

I am setting up a system at SliceHost, on one of their Ubuntu Dapper slices. First, I'm not as familiar with Ubuntu as I am Fedora, but this is one reason I chose Ubuntu (to get more experience). Anyway, I found several other blog posts and such on the web about this, but none worked perfectly. I glommed mine together by using them though. Here they are:



And, here's what I did. First, uncomment the universe lines in /etc/apt/sources.list. Then...



# apt-get update# apt-get dist-upgrade
# apt-get install ruby ruby1.8-dev ri rdoc
# ln -s /usr/bin/irb1.8 /usr/local/bin/irb# wget http://rubyforge.org/frs/download.php/11289/rubygems-0.9.0.tgz
# tar xvzf rubygems-0.9.0.tgz
# cd rubygems-0.9.0
# ruby setup.rb
# cd ..
# rm -rf rubygems*
# gem install rails --include-dependencies
# dpkg --purge apache apache2 (this removes Apache if it exists, which it didn't)
# apt-get install build-essential zlib1g-dev
# wget http://apache.rmplc.co.uk/httpd/httpd-2.2.2.tar.gz
# tar xzvf httpd-2.2.2.tar.gz
# cd httpd-2.2.2
# ./configure --prefix=/usr/local/apache2 --enable-mods-shared=all --enable-deflate --enable-proxy --enable-proxy-balancer --enable-proxy-http
# make
# make install
# cd ..
# rm -rf httpd*
# apt-get install postfix (Then, use the "Internet Site" default setting, and picked "WeighPals.com" as the name)
# apt-get install mysql-server mysql-common mysql-client libmysqlclient15-dev libmysqlclient15off
# apt-get install libmysql-ruby1.8
# gem install daemons gem_plugin mongrel mongrel_cluster --include-dependencies

technorati tags:, , ,

Loading mentions Retweet
Filed under  //   Apache   Linux   Ruby   RubyOnRails   Ubuntu  

Comments [0]