Hi,
I’am looking for a small webserver running some ruby classes/servlets.
My first steps I was going with webrick, but the memory footprint
is unacceptable for the target plattform.
Anybody knows a small webserver, which is able to run some ruby code ?
Greetings
Michael
On Nov 15, 2007 9:53 AM, Michael C. [email protected]
wrote:
Hi,
I’am looking for a small webserver running some ruby classes/servlets.
My first steps I was going with webrick, but the memory footprint
is unacceptable for the target plattform.
Anybody knows a small webserver, which is able to run some ruby code ?
Not sure what you mean by “small,” since you’ll need to load in the
Ruby interpreter if you want to run Ruby code. Have a look at the HTTP
server built into the Ruby/EventMachine package.
mongrel. do your googling next time
On Nov 15, 2007, at 9:18 AM, Marcin R. wrote:
try hacking your own (i did it once in perl) but it’ll be buggy, and
will not support some strange browsers.
A simple mongrel handler uses about 6-7MB of ram for me on 32bit
systems. What all are you loading to get it to 16MB?
-Ezra
Michael C. wrote:
I didn’t know memory was that important, unfortunatelly there’s no other
server that’s stable and have lower memory footprint, you an try hacking
your own (i did it once in perl) but it’ll be buggy, and will not
support some strange browsers.
Hi,
A simple mongrel handler uses about 6-7MB of ram for me on 32bit
systems. What all are you loading to get it to 16MB?
you are (nearly) right, after startup the mongrel uses about 7-8 MB non
relocatable
memory (rss option). But at the same time, the data resident segment
(drs option, rss included)
shows 18 MB of RAM. In comparison, webrick needs about 5 MB rss and 14
MB drs.
In contrast the plain ruby interpreter needs about 1,5 MB rss and 3 MB
drs.
ps -eo pid,args,drs,rss|grep ruby
4782 ruby webrick.rb 14322 4872
4783 ruby mongrel.rb 18322 7776
4820 ruby -e sleep 60 3266 1548
I will give lighttp a try, thanks for your help
Micha
In contrast the plain ruby interpreter needs about 1,5 MB rss and 3 MB drs.
Are you using a staticly linked ruby or shared libraries? ps aux isn’t
a great
indicator of memory usage because it will overlap shared libraries.
"pmap -d "
will give you a better indicator of memory usage, and I’m guessing you
could toy
with your thread stack size in ulimit to reduce actual footprint quite a
bit if
necessary.
Caleb
On Nov 15, 2007, at 07:34 , Marcin R. wrote:
mongrel. do your googling next time
You forgot your manners.
On Nov 15, 12:18 pm, Marcin R. [email protected] wrote:
I didn’t know memory was that important
Apparently in your rush to be rude, you didn’t even bother to read the
OP. Rudeness plus ignorance is a bad combination.
“looking for a small webserver”
“the memory footprint is unacceptable”
“Anybody knows a small webserver”
On Nov 15, 2007 6:35 PM, Michael C. [email protected]
wrote:
loading a ruby interpreter is no problem, I’am running other ruby software
on the embedded device without problems (7-8 MB RAM usage). The problem
only occurs in combination with webrick. At startup 8 MB RAM are used,
after the first request, 16 MB RAM are blocked.
Give Lighttpd a try. It might be a bit more “lightweight” than mongrel.
Michael C. schrieb:
Hi,
I’am looking for a small webserver running some ruby classes/servlets.
My first steps I was going with webrick, but the memory footprint
is unacceptable for the target plattform.
Anybody knows a small webserver, which is able to run some ruby code ?
I’m currently embedding Ruby into nginx (www.nginx.net). It’s not yet
done as I
started yesterday and as I’m doing it for fun… A minimal worker
process has
~2MB at the moment. I think it’s impossible to reduce this any more.
My initial benchmarks (which doesn’t say anything) showed it to be at
least
2-times as fast as mongrel.
Regards,
Michael
On Nov 16, 2007, at 5:23 AM, Michael N. wrote:
yet done as I started yesterday and as I’m doing it for fun… A
minimal worker process has ~2MB at the moment. I think it’s
impossible to reduce this any more.
My initial benchmarks (which doesn’t say anything) showed it to be
at least 2-times as fast as mongrel.
Regards,
Michael
Michael-
I’d love to play with ruby embedded in nginx. Care to have any
testers? How are you dealing with the event driven nature of nginx
when embedding the ruby interpreter? Do ruby requests block the entire
worker process while they run?
Cheers-
-Ezra
On Nov 16, 2007, at 6:23 AM, Michael N. wrote:
I’m currently embedding Ruby into nginx (www.nginx.net). It’s not
yet done as I started yesterday and as I’m doing it for fun… A
minimal worker process has ~2MB at the moment. I think it’s
impossible to reduce this any more.
My initial benchmarks (which doesn’t say anything) showed it to be
at least 2-times as fast as mongrel.
i just started hacking on this too! i’m leaning towards simply
wrapping one nginx to to ruby fastcgi process and going from there -
but a ruby module looks very interesting. any code in repo?
cheers.
a @ http://codeforpeople.com/
On Nov 15, 2007 2:53 PM, Michael C. [email protected]
wrote:
Greetings
Michael
Not sure how small in machine memory it is, but in terms of cognitive
load, rack is as light as you can get. See
http://yeahnah.org/files/rack-presentation-oct-07.pdf and
http://rack.rubyforge.org/
Regards,
Sean
ara.t.howard schrieb:
i just started hacking on this too! i’m leaning towards simply wrapping
one nginx to to ruby fastcgi process and going from there - but a ruby
module looks very interesting. any code in repo?
Not yet. Maybe in a few days.
Well it turned out that 2MB is only the case if I use libruby18-static.
Regards,
Michael
On Nov 16, 6:23 am, Michael N. [email protected] wrote:
I’m currently embedding Ruby into nginx (www.nginx.net). It’s not yet done as I
started yesterday and as I’m doing it for fun… A minimal worker process has
~2MB at the moment. I think it’s impossible to reduce this any more.
My initial benchmarks (which doesn’t say anything) showed it to be at least
2-times as fast as mongrel.
Regards,
Michael
I’d love to play with it!
AEM
Ezra Z. schrieb:
I’m currently embedding Ruby into nginx (www.nginx.net). It’s not yet
Michael-
I'd love to play with ruby embedded in nginx. Care to have any
testers? How are you dealing with the event driven nature of nginx when
embedding the ruby interpreter? Do ruby requests block the entire worker
process while they run?
In the initial version a Ruby request handler would block the entire
work
process, i.e. performances depends on how long the request handler
takes, which
clearly is not optimal. Despite of that, it was in all cases faster than
mongrel, simply because all requests had to wait (in reality there are
fast
requests and slow requests). But that’s clearly a non-optimal (at least
theoretical) solution
What I am doing now is to embed a Ruby pthread into nginx and use nginx
upstream
handlers to post requests to this pthread and receive responses. I’m
still
having a few problems here, especially with Ruby 1.9, which I’d like to
use due
to it’s native threads (so that Ruby request handlers do not block each
other).
I can’t await to see how it performs compared to mongrel.
Once I have a mostly working version of this out, I’ll announce it on
ruby-talk.
Regards,
Michael