[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Why is webrick sooo slow?

George Moschovitis

1/24/2005 4:43:00 PM

Hello everyone,

I just finished the first working version of the new abstract rendering
pipeline for Nitro. This new pipeline, allows for multiple adaptors
(webrick, fastcgi, cgi, modruby, etc) running the same web application.


Even though the new pipeline is not yet optimized, I run a benchmark to
compare webrick's performance vs fastcgi. I was quite shocked to see
the following results on my trusty old laptop:

$ ab -n 200 -c 5 localhost/index

lighttpd/fastcgi: 175.22 requests/sec
webrick: 29.02 requests/sec

I find this performance delta rather suprising.

On the topic of fastcgi, I always had the following question: Isn't an
apache-fastcgi-rubyserver configuration equivalent to an
apache-mod_proxy-rubyserver configuration?


regards,
George.

10 Answers

George Moschovitis

1/24/2005 5:01:00 PM

0

Whats makes this performance difference more amazing is that I used the
pure-ruby fcgi library. I 'll try again with the C-version library
later.

-g.

George Moschovitis

1/24/2005 5:11:00 PM

0

Well,

the C fcgi library was faster as expected:

x1. lighttpd/C-fastcgi: 225.41 requests/sec
x2. lighttpd/ruby-fastcgi: 175.22 requests/sec
x3. webrick: 29.02 requests/sec

x1-x2 is excpected, but I think that x2-x3 is too much.
Any comments?

George.

Michael Neumann

1/24/2005 5:19:00 PM

0

George Moschovitis wrote:
> Whats makes this performance difference more amazing is that I used the
> pure-ruby fcgi library. I 'll try again with the C-version library
> later.

hm, what are you doing that you only get 30 req/sec? On my Centrino 1300
laptop, I got 333 req/sec with a simple static WEBrick filehandler (3728
bytes), and still 85 req/sec when using Wee to render the same page, and
165 req/sec just for the action phase in Wee (the real req/sec is of
course 1/(1/85 + 1/165) = 56 ).

Regards,

Michael


George Moschovitis

1/24/2005 5:39:00 PM

0

Hello Michael,

I hit a page with that session (reads session cookie), there is some
simple
processing and some gfx.

In my benchmark I have 5 concurrent users (ab -n 200 -c 5)

My laptop uses a P3 at 1000 Ghz, this is *much* slower than the
Centrino.

Hmm, maybe I am doing something stupid (like having some debug flags
on). I 'll investigate further? Anyone else, has more comments?

-g.

George Moschovitis

1/24/2005 5:45:00 PM

0

Well, not only webrick is slow, so is my laptop :)

> I got 333 req/sec with a simple static WEBrick filehandler

I benchmark this simple page:

<html>test</html>

with Webricks FileHandler and I got 48 req/seq. This is exactly the
same as I get with the original Nitro benchmark if I dissable the
session from the page.

So the question remains, is Webrick sooo much slowet than
lighttpd/fcgi?

-g.

Joao Pedrosa

1/24/2005 6:40:00 PM

0

Hi,

> So the question remains, is Webrick sooo much slowet than
> lighttpd/fcgi?

I'm afraid that total independence of the webservers is not possible
yet. WEBrick is fast enough for development and small servers, and
that's it. :-)

Maybe someone could rewrite WEBrick in RubyC. :-)

YARV is interesing with the general performance improvements. But how
long till we can run WEBrick on it? :-)

When I think about serving large binary files with WEBrick, I soon
realize that we really need webservers.

Cheers,
Joao


Alexander Kellett

1/31/2005 12:01:00 PM

0

On Jan 24, 2005, at 7:39 PM, Joao Pedrosa wrote:
> When I think about serving large binary files with WEBrick, I soon
> realize that we really need webservers.

with large files the difference is theoretically
*much* lower. its the small files that suffer from
latency problems for a webserver written in pure ruby.

i imagine that ruby2c + some clever profiling will
get some damn impressive results.

Alex



Christian Neukirchen

1/31/2005 1:59:00 PM

0

Alexander Kellett <ruby-lists@lypanov.net> writes:

> On Jan 24, 2005, at 7:39 PM, Joao Pedrosa wrote:
>> When I think about serving large binary files with WEBrick, I soon
>> realize that we really need webservers.
>
> with large files the difference is theoretically
> *much* lower. its the small files that suffer from
> latency problems for a webserver written in pure ruby.
>
> i imagine that ruby2c + some clever profiling will
> get some damn impressive results.
>
> Alex

Note that for raw IO, a well-tuned server can use OS-depended calls
like sendfile(2), which are not directly accessible through Ruby.

--
Christian Neukirchen <chneukirchen@gmail.com> http://chneuk...


Alexander Kellett

1/31/2005 2:10:00 PM

0

On Jan 31, 2005, at 2:58 PM, Christian Neukirchen wrote:
>> i imagine that ruby2c + some clever profiling will
>> get some damn impressive results.
>
> Note that for raw IO, a well-tuned server can use OS-depended calls
> like sendfile(2), which are not directly accessible through Ruby.

but a quick 5 minute ruby/inline job would
make it available on supported platforms :)

Alex



Christian Neukirchen

1/31/2005 3:45:00 PM

0

Alexander Kellett <ruby-lists@lypanov.net> writes:

> On Jan 31, 2005, at 2:58 PM, Christian Neukirchen wrote:
>>> i imagine that ruby2c + some clever profiling will
>>> get some damn impressive results.
>>
>> Note that for raw IO, a well-tuned server can use OS-depended calls
>> like sendfile(2), which are not directly accessible through Ruby.
>
> but a quick 5 minute ruby/inline job would
> make it available on supported platforms :)

ruby/dl should be enough for that.

> Alex
--
Christian Neukirchen <chneukirchen@gmail.com> http://chneuk...