# \[ANN\] Mongrel 0.1.1 -- A Fast Ruby Web Server (It Works Now, Maybe)

**URL:** <https://rubytalk.org/t/ann-mongrel-0-1-1-a-fast-ruby-web-server-it-works-now-maybe/24197>\
**Category:** ruby-talk\
**Created:** [20 January 2006 12:31 UTC](https://rubytalk.org/t/ann-mongrel-0-1-1-a-fast-ruby-web-server-it-works-now-maybe/24197 "2006-01-20T12:31:16Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zed\_A\_Shaw](https://avatars.discourse-cdn.com/v4/letter/z/5fc32e/32.png) [@Zed\_A\_Shaw](https://rubytalk.org/u/Zed_A_Shaw)\
**Post date:** [20 January 2006 12:31 UTC](https://rubytalk.org/t/ann-mongrel-0-1-1-a-fast-ruby-web-server-it-works-now-maybe/24197/1 "2006-01-20T12:31:16Z")

</div>

Hi All,

I previously announce Mongrel 0.1.0, but since I released that late at night it of course had errors. This is just a small announcement for the fixed source:

[http://www.zedshaw.com/downloads/mongrel-0.1.1.tar.bz2](http://www.zedshaw.com/downloads/mongrel-0.1.1.tar.bz2)

Please grab this one and give it a try.

INSTALL

You can grab the above source and then do:

&nbsp;&nbsp;&nbsp;rake  
&nbsp;&nbsp;&nbsp;ruby -Ilib examples/simpletest.rb &  
&nbsp;&nbsp;&nbsp;curl [http://localhost:3000/test](http://localhost:3000/test)

It should print out "hello!". Check the source of examples/simpletest.rb to see how it's used.

\*\*\* It requires Ruby 1.8.4 to work and a C compiler to compile a small portable extension. \*\*\*

WHAT IT IS

Mongrel is a web server I wrote this week that performs \*much\* better than WEBrick (1350 vs 175 req/sec) and only has one small C extension. I'm looking to make Mongrel the answer to Java's Tomcat as a means of hosting Ruby web applications. Feel free to send me your dreams about a (sort of) Ruby hosting library.

Special thanks to Ezra and Sascha for testing and finding this.

Zed A. Shaw  
[http://www.zedshaw.com/](http://www.zedshaw.com/)

---

<div class="post-metadata">

**Author:** ![Robert\_Feldt](https://avatars.discourse-cdn.com/v4/letter/r/7993a0/32.png) [@Robert\_Feldt](https://rubytalk.org/u/Robert_Feldt)\
**Post date:** [20 January 2006 13:04 UTC](https://rubytalk.org/t/ann-mongrel-0-1-1-a-fast-ruby-web-server-it-works-now-maybe/24197/2 "2006-01-20T13:04:35Z")

</div>

In future perf comparisons it would be great if you also compare it to  
apache and/or lighttpd in a similar setup/situation just to factor out  
the specifics of the machine you test it on.

Thanks,

Robert Feldt

---

<div class="post-metadata">

**Author:** ![Alciato](https://avatars.discourse-cdn.com/v4/letter/a/ee59a6/32.png) [@Alciato](https://rubytalk.org/u/Alciato)\
**Post date:** [20 January 2006 13:43 UTC](https://rubytalk.org/t/ann-mongrel-0-1-1-a-fast-ruby-web-server-it-works-now-maybe/24197/3 "2006-01-20T13:43:35Z")

</div>

Compiles and run without problems under fedora core4 (with an AMD 800  
Mhz 500M Ram)

siege -u [http://localhost:3000/test](http://localhost:3000/test) -d1 -r10 -c25

mongrel

> **···**
>
> \_\_\_\_\_\_\_
> 
> Elapsed time: 8.22 secs  
> Data transferred: 0.00 MB  
> Response time: 0.01 secs  
> Transaction rate: 30.41 trans/sec  
> Concurrency: 0.20  
> Longest transaction: 0.12  
> Shortest transaction: 0.00
> 
> webwrick  
> \_\_\_\_\_\_\_\_
> 
> Elapsed time: 10.99 secs  
> Data transferred: 0.00 MB  
> Response time: 0.20 secs  
> Transaction rate: 22.75 trans/sec  
> Concurrency: 4.53  
> Longest transaction: 3.17  
> Shortest transaction: 0.01
> 
> --  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

---

<div class="post-metadata">

**Author:** ![Sasa\_Ebach](https://avatars.discourse-cdn.com/v4/letter/s/e495f1/32.png) [@Sasa\_Ebach](https://rubytalk.org/u/Sasa_Ebach)\
**Post date:** [20 January 2006 17:14 UTC](https://rubytalk.org/t/ann-mongrel-0-1-1-a-fast-ruby-web-server-it-works-now-maybe/24197/4 "2006-01-20T17:14:51Z")

</div>

this is my output under Cygwin now:

$ ruby -v  
ruby 1.8.3 (2005-09-21) [i386-cygwin]

$ rake  
(in /cygdrive/h/Download/Browser/mongrel-0.1.1)  
/usr/bin/ruby extconf.rb  
checking for main() in -lc... yes  
creating Makefile  
make  
gcc -g -O2 -I. -I/usr/lib/ruby/1.8/i386-cygwin -I/usr/lib/ruby/1.8/i386-cygwin -I. -c http11.c  
gcc -g -O2 -I. -I/usr/lib/ruby/1.8/i386-cygwin -I/usr/lib/ruby/1.8/i386-cygwin -I. -c http11\_parser.c  
gcc -shared -s -Wl,--enable-auto-import,--export-all -L"/usr/lib" -o [http11.so](http://http11.so) http11.o http11\_parser.o -lruby -lc -lcrypt  
cp ext/http11/http11.so lib  
/usr/bin/ruby -Ilib:test "/usr/lib/ruby/gems/1.8/gems/rake-0.6.2/lib/rake/rake\_test\_loader.rb" "test/test\_http11.rb" "test/test\_trie.rb" "te  
st/test\_ws.rb"  
Loaded suite /usr/lib/ruby/gems/1.8/gems/rake-0.6.2/lib/rake/rake\_test\_loader  
Started  
Error result after 6 bytes of 15  
.Read 18 string was 18  
...Hitting server  
.  
Finished in 2.048 seconds.

5 tests, 10 assertions, 0 failures, 0 errors

$ ruby -Ilib examples/simpletest.rb &  
[1] 4692

$ curl [http://localhost:3000/test](http://localhost:3000/test)  
hello!

$ ./ab.exe -S -n 3000 [http://localhost:3000/test](http://localhost:3000/test)  
Concurrency Level: 1  
Time taken for tests: 5.656250 seconds  
Complete requests: 3000  
Failed requests: 0  
Write errors: 0  
Total transferred: 156000 bytes  
HTML transferred: 21000 bytes  
Requests per second: 530.39 [#/sec] (mean)  
Time per request: 1.885 [ms] (mean)  
Time per request: 1.885 [ms] (mean, across all concurrent requests)  
Transfer rate: 26.87 [Kbytes/sec] received

WOW, that is really something for Cygwin (Ruby/Cygwin is \_really\_ slow). It would be nice if there were at least a WEBrick benchmark included, so one could make a direct comparison. If you could get Mongrel to be at least half as fast as lighttpd that would be really something. Than it would be an alternative for production.

-Sascha

---

<div class="post-metadata">

**Author:** ![why\_the\_lucky\_stiff1](https://avatars.discourse-cdn.com/v4/letter/w/898d66/32.png) [@why\_the\_lucky\_stiff1](https://rubytalk.org/u/why_the_lucky_stiff1)\
**Post date:** [20 January 2006 19:32 UTC](https://rubytalk.org/t/ann-mongrel-0-1-1-a-fast-ruby-web-server-it-works-now-maybe/24197/5 "2006-01-20T19:32:14Z")

</div>

Zed Shaw wrote:

> I previously announce Mongrel 0.1.0, but since I released that late at night it of course had errors. This is just a small announcement for the fixed source:
> 
> [http://www.zedshaw.com/downloads/mongrel-0.1.1.tar.bz2](http://www.zedshaw.com/downloads/mongrel-0.1.1.tar.bz2)
> 
> Please grab this one and give it a try.

This is a fantasy come true. Works nicely on Linux. Sensational! An era has opened.

I got Camping working with `register', but it needs both SCRIPT\_NAME and PATH\_INFO filled properly to work right. In the case of a script mounted at /blog, a /blog/view request should end up as (following the traditional CGI ways):

&nbsp;&nbsp;SCRIPT\_NAME = /blog  
&nbsp;&nbsp;PATH\_INFO = /view

Anyway, here's a crappy postamble for any Camping scripts out there (none):

&nbsp;&nbsp;if \_\_FILE\_\_ == $0  
&nbsp;&nbsp;&nbsp;&nbsp;Camping::Models::Base.establish\_connection :adapter =\> 'sqlite3', :database =\> 'blog3.db'  
&nbsp;&nbsp;&nbsp;&nbsp;Camping::Models::Base.logger = Logger.new('camping.log')  
&nbsp;&nbsp;&nbsp;&nbsp;require 'mongrel'

&nbsp;&nbsp;&nbsp;&nbsp;class CampingHandler \< Mongrel::HttpHandler  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;def process(request, response)  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Object.instance\_eval do  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;remove\_const :ENV  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;const\_set :ENV, request  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ENV['PATH\_INFO'] = '/'  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;s = response.socket  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;def s.\<\<(str)  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;write("HTTP/1.1 200 OK\r\n#{str}")  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Camping.run('', response.socket)  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end  
&nbsp;&nbsp;&nbsp;&nbsp;end

&nbsp;&nbsp;&nbsp;&nbsp;h = Mongrel::HttpServer.new("0.0.0.0", "3000")  
&nbsp;&nbsp;&nbsp;&nbsp;h.register("/blog", CampingHandler.new)  
&nbsp;&nbsp;&nbsp;&nbsp;h.run.join  
&nbsp;&nbsp;end

\_why

---

<div class="post-metadata">

**Author:** ![Michael\_A\_Schoen1](https://avatars.discourse-cdn.com/v4/letter/m/53a042/32.png) [@Michael\_A\_Schoen1](https://rubytalk.org/u/Michael_A_Schoen1)\
**Post date:** [20 January 2006 19:33 UTC](https://rubytalk.org/t/ann-mongrel-0-1-1-a-fast-ruby-web-server-it-works-now-maybe/24197/6 "2006-01-20T19:33:08Z")

</div>

Zed,

Cool stuff. Is the intent that this enables an even more straightforward approach for running apps (such as a RoR app) than scgi under lighttpd? Ie., rather than scgi under lighttpd, just use mod\_proxy?

Did you read this post, where Mark Mayo wonders why the newer frameworks haven't just been using an http interface (and instead have struggled with fcgi)?

[http://www.vmunix.com/mark/blog/archives/2006/01/02/fastcgi-scgi-and-apache-background-and-future/](http://www.vmunix.com/mark/blog/archives/2006/01/02/fastcgi-scgi-and-apache-background-and-future/)

thanks,  
Michael

---

<div class="post-metadata">

**Author:** ![PA1](https://avatars.discourse-cdn.com/v4/letter/p/71c47a/32.png) [@PA1](https://rubytalk.org/u/PA1)\
**Post date:** [21 January 2006 21:07 UTC](https://rubytalk.org/t/ann-mongrel-0-1-1-a-fast-ruby-web-server-it-works-now-maybe/24197/7 "2006-01-21T21:07:15Z")

</div>

Being a sucker for meaningless benchmarks I had to run this as well :))

[Mongrel]  
% ruby -v  
ruby 1.8.4 (2005-12-24) [powerpc-darwin7.9.0]  
% ruby simpletest.rb  
% ab -n 10000 [http://localhost:3000/test](http://localhost:3000/test)  
Requests per second: 660.20 [#/sec] (mean)

(I get a terse "ERROR: Object" from time to time)

[Webrick]  
% ruby -v  
ruby 1.8.4 (2005-12-24) [powerpc-darwin7.9.0]  
% ruby webrick\_compare.rb \>& /dev/null  
% ab -n 10000 [http://localhost:4000/test](http://localhost:4000/test)  
Requests per second: 37.90 [#/sec] (mean)

Here is something in python:

[Cherrypy][1]  
% python -V  
Python 2.4.2  
% python tut01\_helloworld.py  
% ab -n 10000 [http://localhost:8080/](http://localhost:8080/)  
Requests per second: 164.92 [#/sec] (mean)

And a bit of Lua [2] to round it up:

[LuaWeb][3]  
% lua -v  
Lua 5.1 Copyright (C) 1994-2006 Lua.org, PUC-Rio  
% lua Test.lua  
% ab -n 10000 [http://localhost:1080/hello](http://localhost:1080/hello)  
Requests per second: 948.32 [#/sec] (mean)

Cheers

> **···**
>
> On Jan 20, 2006, at 13:31, Zed Shaw wrote:
> 
> > Mongrel is a web server I wrote this week that performs \*much\* better than WEBrick (1350 vs 175 req/sec) and only has one small C extension.
> 
> --  
> PA, Onnay Equitursay  
> [http://alt.textdrive.com/](http://alt.textdrive.com/)
> 
> [1] [http://www.cherrypy.org/](http://www.cherrypy.org/)  
> [2] [Lua: about](http://www.lua.org/about.html)  
> [3] [http://dev.alt.textdrive.com/browser/LW/](http://dev.alt.textdrive.com/browser/LW/)

---

<div class="post-metadata">

**Author:** ![Kirk\_Haines](https://avatars.discourse-cdn.com/v4/letter/k/c6cbf5/32.png) [@Kirk\_Haines](https://rubytalk.org/u/Kirk_Haines)\
**Post date:** [20 January 2006 21:21 UTC](https://rubytalk.org/t/ann-mongrel-0-1-1-a-fast-ruby-web-server-it-works-now-maybe/24197/8 "2006-01-20T21:21:06Z")

</div>

When running IOWA apps under webrick, one can do exactly this. I don't do  
that for production apps, however, because the performance penalty. Even  
with the socket overhead, Apache or lighttpd with fcgi, or Apache with  
mod\_ruby are both substantially faster.

If mongrel proves fast enough, though, using a proxy approach would become a  
very viable alternative for production apps.

Kirk Haines

> **···**
>
> On Friday 20 January 2006 12:33 pm, Michael Schoen wrote:
> 
> > Cool stuff. Is the intent that this enables an even more straightforward  
> > approach for running apps (such as a RoR app) than scgi under lighttpd?  
> > Ie., rather than scgi under lighttpd, just use mod\_proxy?
> > 
> > Did you read this post, where Mark Mayo wonders why the newer frameworks  
> > haven't just been using an http interface (and instead have struggled  
> > with fcgi)?

---

<div class="post-metadata">

**Author:** ![Zed\_A\_Shaw](https://avatars.discourse-cdn.com/v4/letter/z/5fc32e/32.png) [@Zed\_A\_Shaw](https://rubytalk.org/u/Zed_A_Shaw)\
**Post date:** [21 January 2006 01:16 UTC](https://rubytalk.org/t/ann-mongrel-0-1-1-a-fast-ruby-web-server-it-works-now-maybe/24197/9 "2006-01-21T01:16:50Z")

</div>

I'm planning a better performance comparison in the future, those metrics were just quick dirty ones to proof the concept.

Zed A. Shaw

> **[Zed A. shaw](https://zedshaw.com/)**
>
> Personal essays and writings by Zed A. Shaw.

> **···**
>
> On Jan 20, 2006, at 8:04 AM, Robert Feldt wrote:
> 
> > In future perf comparisons it would be great if you also compare it to  
> > apache and/or lighttpd in a similar setup/situation just to factor out  
> > the specifics of the machine you test it on.
> > 
> > Thanks,
> > 
> > Robert Feldt

---

<div class="post-metadata">

**Author:** ![Zed\_A\_Shaw](https://avatars.discourse-cdn.com/v4/letter/z/5fc32e/32.png) [@Zed\_A\_Shaw](https://rubytalk.org/u/Zed_A_Shaw)\
**Post date:** [21 January 2006 01:18 UTC](https://rubytalk.org/t/ann-mongrel-0-1-1-a-fast-ruby-web-server-it-works-now-maybe/24197/10 "2006-01-21T01:18:58Z")

</div>

Thanks Alciato, it seems to be pretty portable so far, so the inclusion of the small C extension isn't such a bad idea.

One thing though--and I'm just picking nits though--Siege is a really bad tool for performance testing. Try out httperf or even apachebench since they give much more accurate statistics. Also, you'll want to run many more requests. It takes 10000 on my machine to get a stable performance characteristics.

Anyway, thanks for the feedback and watch for more.

Zed A. Shaw

> **[Zed A. shaw](https://zedshaw.com/)**
>
> Personal essays and writings by Zed A. Shaw.

> **···**
>
> On Jan 20, 2006, at 8:43 AM, Alciato wrote:
> 
> > Compiles and run without problems under fedora core4 (with an AMD 800  
> > Mhz 500M Ram)
> > 
> > siege -u [http://localhost:3000/test](http://localhost:3000/test) -d1 -r10 -c25
> > 
> > mongrel  
> > \_\_\_\_\_\_\_
> > 
> > Elapsed time: 8.22 secs  
> > Data transferred: 0.00 MB  
> > Response time: 0.01 secs  
> > Transaction rate: 30.41 trans/sec  
> > Concurrency: 0.20  
> > Longest transaction: 0.12  
> > Shortest transaction: 0.00
> > 
> > webwrick  
> > \_\_\_\_\_\_\_\_
> > 
> > Elapsed time: 10.99 secs  
> > Data transferred: 0.00 MB  
> > Response time: 0.20 secs  
> > Transaction rate: 22.75 trans/sec  
> > Concurrency: 4.53  
> > Longest transaction: 3.17  
> > Shortest transaction: 0.01
> > 
> > --  
> > Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).

---

<div class="post-metadata">

**Author:** ![Zed\_A\_Shaw](https://avatars.discourse-cdn.com/v4/letter/z/5fc32e/32.png) [@Zed\_A\_Shaw](https://rubytalk.org/u/Zed_A_Shaw)\
**Post date:** [21 January 2006 01:21 UTC](https://rubytalk.org/t/ann-mongrel-0-1-1-a-fast-ruby-web-server-it-works-now-maybe/24197/11 "2006-01-21T01:21:06Z")

</div>

That's sweet. Didn't even think it would go that fast on Cygwin. Great news as this means there's an exit strategy for IIS and Win32 people other than SCGI. Now if I can just the win32 version of fork working I'd be gold.

One thing, could you do the same test against WEBrick using the examples/webrick\_compare.rb script? Just for my info. You'll need to \> /dev/null the output to make the test more fair.

Zed A. Shaw

> **[Zed A. shaw](https://zedshaw.com/)**
>
> Personal essays and writings by Zed A. Shaw.

> **···**
>
> On Jan 20, 2006, at 12:14 PM, Sascha Ebach wrote:
> 
> > $ ./ab.exe -S -n 3000 [http://localhost:3000/test](http://localhost:3000/test)  
> > Concurrency Level: 1  
> > Time taken for tests: 5.656250 seconds  
> > Complete requests: 3000  
> > Failed requests: 0  
> > Write errors: 0  
> > Total transferred: 156000 bytes  
> > HTML transferred: 21000 bytes  
> > Requests per second: 530.39 [#/sec] (mean)  
> > Time per request: 1.885 [ms] (mean)  
> > Time per request: 1.885 [ms] (mean, across all concurrent requests)  
> > Transfer rate: 26.87 [Kbytes/sec] received
> > 
> > WOW, that is really something for Cygwin (Ruby/Cygwin is \_really\_ slow). It would be nice if there were at least a WEBrick benchmark included, so one could make a direct comparison. If you could get Mongrel to be at least half as fast as lighttpd that would be really something. Than it would be an alternative for production.
> > 
> > -Sascha

---

<div class="post-metadata">

**Author:** ![Zed\_A\_Shaw](https://avatars.discourse-cdn.com/v4/letter/z/5fc32e/32.png) [@Zed\_A\_Shaw](https://rubytalk.org/u/Zed_A_Shaw)\
**Post date:** [21 January 2006 01:24 UTC](https://rubytalk.org/t/ann-mongrel-0-1-1-a-fast-ruby-web-server-it-works-now-maybe/24197/12 "2006-01-21T01:24:22Z")

</div>

> This is a fantasy come true. Works nicely on Linux. Sensational! An era has opened.

Thanks! Yeah, I'm totally excited about it. I may finally be able to shut those "performance" whiners up. 🙂

> I got Camping working with `register', but it needs both SCRIPT\_NAME and PATH\_INFO filled properly to work right. In the case of a script mounted at /blog, a /blog/view request should end up as (following the traditional CGI ways):

Right, I have to work out the interplay of the register function and how script/path info would work. Also have to CGI convert the request parameters and a few other niceties. I'm contemplating where you would register handlers, and you'd be able to say whether it has to be an exact match, or a partial match. If it's partial then the matched part would be the SCRIPT\_NAME, the rest PATH\_INFO. If it's exact then I'm not sure what.

Any suggestions on this would be great. Basically, what would be your dream URI response scheme?

Zed A. Shaw

> **[Zed A. shaw](https://zedshaw.com/)**
>
> Personal essays and writings by Zed A. Shaw.

> **···**
>
> On Jan 20, 2006, at 2:32 PM, why the lucky stiff wrote:

---

<div class="post-metadata">

**Author:** ![Zed\_A\_Shaw](https://avatars.discourse-cdn.com/v4/letter/z/5fc32e/32.png) [@Zed\_A\_Shaw](https://rubytalk.org/u/Zed_A_Shaw)\
**Post date:** [21 January 2006 01:33 UTC](https://rubytalk.org/t/ann-mongrel-0-1-1-a-fast-ruby-web-server-it-works-now-maybe/24197/13 "2006-01-21T01:33:35Z")

</div>

> Zed,
> 
> Cool stuff. Is the intent that this enables an even more straightforward approach for running apps (such as a RoR app) than scgi under lighttpd? Ie., rather than scgi under lighttpd, just use mod\_proxy?

Yes, the intention is to produce the optimal deployment scenario for Ruby web applications. A secondary purpose is to prove my unofficial "Zed's STFU Performance Razor":

"All languages are as fast as the fastest language they can access so STFU."

🙂

I'm imagining that if I can get the various web frameworks to run well and fast under Mongrel, and sprinkle in a few sexy features, then it'd be the best way to deploy the applications. I'm thinking a primary concern is performance, followed by ease of deployment, then management, and finally API simplicity. What's nice with just plain HTTP is that there's already a mountain of support for production HTTP hosting and deployment technology.

> Did you read this post, where Mark Mayo wonders why the newer frameworks haven't just been using an http interface (and instead have struggled with fcgi)?
> 
> [http://www.vmunix.com/mark/blog/archives/2006/01/02/fastcgi-scgi-and-apache-background-and-future/](http://www.vmunix.com/mark/blog/archives/2006/01/02/fastcgi-scgi-and-apache-background-and-future/)

Yeah, I read that post literally as I was building the precursor to SCGI, and then decided to take the plunge and just do it. The story goes like this:

1) Win32 IIS dudes beg me to get SCGI working under IIS.  
2) I like Win32 dudes, hell I love everybody the same (which is very little, but it's equal at least).  
3) I start working on an HTTP-\>SCGI proxy. I use Ragel to make a clean, fast, and correct parser.  
4) madrobby schools me on my parser with his mountain of browsers until I get it working better.  
5) I keep asking myself, "Why don't I just take the parser and make a Ruby web server?"  
6) I keep asking this but it doesn't sink in. I decide to toy with the idea. Someone shows me the articl Then I read the above article and just do it.  
7) What you have is about 3-4 days later.

So, that's the semi-official story. What I also have though is a HTTP parser that I can break out and make into a library. This means that other languages could possibly pick it up and write their own similarly fast web servers with minimal effort. Keep your fingers crossed.

Zed A. Shaw

> **[Zed A. shaw](https://zedshaw.com/)**
>
> Personal essays and writings by Zed A. Shaw.

> **···**
>
> On Jan 20, 2006, at 2:33 PM, Michael Schoen wrote:

---

<div class="post-metadata">

**Author:** ![Jim\_Freeze3](https://yyz1.discourse-cdn.com/flex029/user_avatar/rubytalk.org/jim_freeze3/32/2022_2.png) [@Jim\_Freeze3](https://rubytalk.org/u/Jim_Freeze3)\
**Post date:** [22 January 2006 15:28 UTC](https://rubytalk.org/t/ann-mongrel-0-1-1-a-fast-ruby-web-server-it-works-now-maybe/24197/14 "2006-01-22T15:28:14Z")

</div>

This is great.  
Can you add Apache to your list of benchmarks?

Jim Freeze

> **···**
>
> On Jan 21, 2006, at 3:07 PM, PA wrote:
> 
> > Being a sucker for meaningless benchmarks I had to run this as well :))
> > 
> > [Mongrel]  
> > Requests per second: 660.20 [#/sec] (mean)
> > 
> > [Webrick]  
> > Requests per second: 37.90 [#/sec] (mean)
> > 
> > [Cherrypy][1]  
> > Requests per second: 164.92 [#/sec] (mean)
> 
> > [LuaWeb][3]  
> > Requests per second: 948.32 [#/sec] (mean)

---

<div class="post-metadata">

**Author:** ![gabriele\_renzi3](https://avatars.discourse-cdn.com/v4/letter/g/7bcc69/32.png) [@gabriele\_renzi3](https://rubytalk.org/u/gabriele_renzi3)\
**Post date:** [24 January 2006 15:43 UTC](https://rubytalk.org/t/ann-mongrel-0-1-1-a-fast-ruby-web-server-it-works-now-maybe/24197/15 "2006-01-24T15:43:56Z")

</div>

PA ha scritto:

> > Mongrel is a web server I wrote this week that performs \*much\* better than WEBrick (1350 vs 175 req/sec) and only has one small C extension.
> 
> Being a sucker for meaningless benchmarks I had to run this as well :))

\<snip\>  
Hey, that was cool. Any chance yo see how would they run with -c 10?  
(and I wonder how fast twisted.web would be 🙂

> **···**
>
> > On Jan 20, 2006, at 13:31, Zed Shaw wrote:

---

<div class="post-metadata">

**Author:** ![Zed\_A\_Shaw](https://avatars.discourse-cdn.com/v4/letter/z/5fc32e/32.png) [@Zed\_A\_Shaw](https://rubytalk.org/u/Zed_A_Shaw)\
**Post date:** [21 January 2006 01:35 UTC](https://rubytalk.org/t/ann-mongrel-0-1-1-a-fast-ruby-web-server-it-works-now-maybe/24197/16 "2006-01-21T01:35:21Z")

</div>

I'd love to make it flexible enough to work with any framework, but I'm starting with ruby on rails. If you've got some sample code of how IOWA maybe runs in WEBrick, or suggestions on what you'd need to get IOWA running, I'd love it.

Zed A. Shaw

> **[Zed A. shaw](https://zedshaw.com/)**
>
> Personal essays and writings by Zed A. Shaw.

> **···**
>
> On Jan 20, 2006, at 4:21 PM, Kirk Haines wrote:
> 
> > On Friday 20 January 2006 12:33 pm, Michael Schoen wrote:
> > 
> > > Cool stuff. Is the intent that this enables an even more straightforward  
> > > approach for running apps (such as a RoR app) than scgi under lighttpd?  
> > > Ie., rather than scgi under lighttpd, just use mod\_proxy?
> > > 
> > > Did you read this post, where Mark Mayo wonders why the newer frameworks  
> > > haven't just been using an http interface (and instead have struggled  
> > > with fcgi)?
> > 
> > When running IOWA apps under webrick, one can do exactly this. I don't do  
> > that for production apps, however, because the performance penalty. Even  
> > with the socket overhead, Apache or lighttpd with fcgi, or Apache with  
> > mod\_ruby are both substantially faster.
> > 
> > If mongrel proves fast enough, though, using a proxy approach would become a  
> > very viable alternative for production apps.

---

<div class="post-metadata">

**Author:** ![Sasa\_Ebach](https://avatars.discourse-cdn.com/v4/letter/s/e495f1/32.png) [@Sasa\_Ebach](https://rubytalk.org/u/Sasa_Ebach)\
**Post date:** [21 January 2006 12:37 UTC](https://rubytalk.org/t/ann-mongrel-0-1-1-a-fast-ruby-web-server-it-works-now-maybe/24197/17 "2006-01-21T12:37:27Z")

</div>

> One thing, could you do the same test against WEBrick using the examples/webrick\_compare.rb script? Just for my info. You'll need to \> /dev/null the output to make the test more fair.

Alright, here you go.

first Mongrel:

ab.exe -S -n 10000 [http://localhost:3000/test](http://localhost:3000/test)  
Concurrency Level: 1  
Time taken for tests: 19.437500 seconds  
Complete requests: 10000  
Failed requests: 0  
Write errors: 0  
Total transferred: 520000 bytes  
HTML transferred: 70000 bytes  
Requests per second: 514.47 [#/sec] (mean)  
Time per request: 1.944 [ms] (mean)  
Time per request: 1.944 [ms] (mean, across all concurrent requests)  
Transfer rate: 26.08 [Kbytes/sec] received

and WEBrick started with

$ ruby -Ilib examples/webrick\_compare.rb 2&\>1 /dev/null &

ab.exe -S -n 10000 [http://localhost:4000/test](http://localhost:4000/test)  
Concurrency Level: 1  
Time taken for tests: 118.62500 seconds  
Complete requests: 10000  
Failed requests: 0  
Write errors: 0  
Total transferred: 1730000 bytes  
HTML transferred: 60000 bytes  
Requests per second: 84.70 [#/sec] (mean)  
Time per request: 11.806 [ms] (mean)  
Time per request: 11.806 [ms] (mean, across all concurrent requests)  
Transfer rate: 14.31 [Kbytes/sec] received

These results are very promising. I bet if you can manage to make a native win32 version the results will double or triple. A 5 times boost will even make Cygwin a viable development environment. I suspect that the win32 version will even be fast enough for production.

-Sascha

PS: With output on the Cygwin/WEBrick combo will drop below 10 req/s on my box.

---

<div class="post-metadata">

**Author:** ![Jeff\_Pritchard](https://avatars.discourse-cdn.com/v4/letter/j/f17d59/32.png) [@Jeff\_Pritchard](https://rubytalk.org/u/Jeff_Pritchard)\
**Post date:** [22 January 2006 17:42 UTC](https://rubytalk.org/t/ann-mongrel-0-1-1-a-fast-ruby-web-server-it-works-now-maybe/24197/18 "2006-01-22T17:42:20Z")

</div>

Noob question here.

No intent to impugn Zed's mad skilz or the need for something like  
Mongrel. I'm just confused by why it would be common to develop or  
deploy a ruby on rails app with something other than production servers  
like Apache.

So far, all of the rails demos I have seen are using webrick. This has  
been true even for setups like macosx that come with apache already set  
up and running.

Does apache not come standard with everything needed to serve a rails  
app? If not, is there an add-on module for apache that makes it  
rails-savvy?

Or is it the case that all rails apps have to be served by a special  
rails server like mongrel or webrick?

thanks,  
jp

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

---

<div class="post-metadata">

**Author:** ![PA1](https://avatars.discourse-cdn.com/v4/letter/p/71c47a/32.png) [@PA1](https://rubytalk.org/u/PA1)\
**Post date:** [22 January 2006 18:13 UTC](https://rubytalk.org/t/ann-mongrel-0-1-1-a-fast-ruby-web-server-it-works-now-maybe/24197/19 "2006-01-22T18:13:27Z")

</div>

[httpd]  
% httpd -v  
Server version: Apache/1.3.33 (Darwin)  
% ab -n 10000 [http://localhost/test.txt](http://localhost/test.txt)  
Requests per second: 1218.47 [#/sec] (mean)

[lighttpd]  
% lighttpd -v  
lighttpd-1.4.9 - a light and fast webserver  
% ab -n 10000 [http://localhost:8888/test.txt](http://localhost:8888/test.txt)  
Requests per second: 3652.30 [#/sec] (mean)

Cheers

> **···**
>
> On Jan 22, 2006, at 16:28, Jim Freeze wrote:
> 
> > Can you add Apache to your list of benchmarks?
> 
> --  
> PA, Onnay Equitursay  
> [http://alt.textdrive.com/](http://alt.textdrive.com/)

---

<div class="post-metadata">

**Author:** ![PA1](https://avatars.discourse-cdn.com/v4/letter/p/71c47a/32.png) [@PA1](https://rubytalk.org/u/PA1)\
**Post date:** [24 January 2006 19:37 UTC](https://rubytalk.org/t/ann-mongrel-0-1-1-a-fast-ruby-web-server-it-works-now-maybe/24197/20 "2006-01-24T19:37:31Z")

</div>

[Mongrel]  
% ruby -v  
ruby 1.8.4 (2005-12-24) [powerpc-darwin7.9.0]  
% ruby simpletest.rb  
% ab -n 10000 -c 10 [http://localhost:3000/test](http://localhost:3000/test)  
Requests per second: 386.31 [#/sec] (mean)

[Webrick]  
% ruby -v  
ruby 1.8.4 (2005-12-24) [powerpc-darwin7.9.0]  
% ruby webrick\_compare.rb \>& /dev/null  
% ab -n 10000 -c 10 [http://localhost:3000/test](http://localhost:3000/test)  
Requests per second: 27.58 [#/sec] (mean)

[Cherrypy]  
% python -V  
Python 2.4.2  
% python tut01\_helloworld.py  
% ab -n 10000 -c 10 [http://localhost:8080/](http://localhost:8080/)  
Requests per second: 164.77 [#/sec] (mean)

[LuaWeb]  
% lua -v  
Lua 5.1 Copyright (C) 1994-2006 Lua.org, PUC-Rio  
% lua Test.lua  
% ab -n 10000 -c 10 [http://localhost:1080/hello](http://localhost:1080/hello)  
Requests per second: 927.04 [#/sec] (mean)

[httpd]  
% httpd -v  
Server version: Apache/1.3.33 (Darwin)  
% ab -n 10000 -c 10 [http://localhost/test.txt](http://localhost/test.txt)  
Requests per second: 1186.10 [#/sec] (mean)

[lighttpd]  
% lighttpd -v  
lighttpd-1.4.9 - a light and fast webserver  
% ab -n 10000 -c 10 [http://localhost:8888/test.txt](http://localhost:8888/test.txt)  
Called sick today (fdevent.c.170: aborted)

Cheers

> **···**
>
> On Jan 24, 2006, at 16:43, gabriele renzi wrote:
> 
> > Hey, that was cool. Any chance yo see how would they run with -c 10?
> 
> --  
> PA, Onnay Equitursay  
> [http://alt.textdrive.com/](http://alt.textdrive.com/)

[Next page](https://rubytalk.org/t/ann-mongrel-0-1-1-a-fast-ruby-web-server-it-works-now-maybe/24197.md?page=2)
