Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > [ANN] Mongrel 0.1.1 -- A Fast Ruby Web Server (It Works Now, Maybe)

Reply
Thread Tools

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

 
 
Zed Shaw
Guest
Posts: n/a
 
      01-20-2006
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

Please grab this one and give it a try.


INSTALL

You can grab the above source and then do:

rake
ruby -Ilib examples/simpletest.rb &
curl 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/


 
Reply With Quote
 
 
 
 
Robert Feldt
Guest
Posts: n/a
 
      01-20-2006
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


 
Reply With Quote
 
 
 
 
Alciato
Guest
Posts: n/a
 
      01-20-2006
Compiles and run without problems under fedora core4 (with an AMD 800
Mhz 500M Ram)

siege -u 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/.


 
Reply With Quote
 
Sascha Ebach
Guest
Posts: n/a
 
      01-20-2006
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 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
 
Reply With Quote
 
why the lucky stiff
Guest
Posts: n/a
 
      01-20-2006
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
>
> 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):

SCRIPT_NAME = /blog
PATH_INFO = /view

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

if __FILE__ == $0
Camping::Models::Base.establish_connection :adapter => 'sqlite3',
:database => 'blog3.db'
Camping::Models::Base.logger = Logger.new('camping.log')
require 'mongrel'

class CampingHandler < Mongrel::HttpHandler
def process(request, response)
Object.instance_eval do
remove_const :ENV
const_set :ENV, request
end
ENV['PATH_INFO'] = '/'
s = response.socket
def s.<<(str)
write("HTTP/1.1 200 OK\r\n#{str}")
end
Camping.run('', response.socket)
end
end

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

_why


 
Reply With Quote
 
Michael Schoen
Guest
Posts: n/a
 
      01-20-2006
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/arch...nd-and-future/

thanks,
Michael



 
Reply With Quote
 
Kirk Haines
Guest
Posts: n/a
 
      01-20-2006
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.


Kirk Haines


 
Reply With Quote
 
Zed Shaw
Guest
Posts: n/a
 
      01-21-2006
I'm planning a better performance comparison in the future, those
metrics were just quick dirty ones to proof the concept.

Zed A. Shaw
http://www.zedshaw.com/

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
>



 
Reply With Quote
 
Zed Shaw
Guest
Posts: n/a
 
      01-21-2006
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
http://www.zedshaw.com/

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 -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/.
>



 
Reply With Quote
 
Zed Shaw
Guest
Posts: n/a
 
      01-21-2006
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
http://www.zedshaw.com/


On Jan 20, 2006, at 12:14 PM, Sascha Ebach wrote:
>
> $ ./ab.exe -S -n 3000 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
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
mongrel service vs mongrel in command shell rabarama Ruby 1 12-15-2009 12:46 PM
[ANN] Mongrel Web Server 0.3.12.2 -- Iron Mongrel (Parser Fix) Zed Shaw Ruby 8 04-05-2006 06:32 AM
Mongrel Web Server 0.3.12.1 -- Iron Mongrel Zed Shaw Ruby 3 04-05-2006 06:31 AM
[ANN] Mongrel HTTP Library 0.2.0 (Fast And RubyForgified) Zed Shaw Ruby 9 02-02-2006 07:22 PM
[ANN] Mongrel 0.1.0 -- A Fast As Hell Mostly Ruby Web Server Zed Shaw Ruby 15 01-21-2006 01:45 AM



Advertisments