mod_ruby & rails doc?

17 views
Skip to first unread message

Aquila

unread,
Jan 11, 2005, 7:40:21 AM1/11/05
to
Is there a place where I can find information on using mod_ruby? A single
stupid example will do, I just can't find anything...
I guess once I get mod_ruby working rails will work too? I don't find any
information on that combination either.

I'm anxious to start using rails!
--
"May the source be with you"

Dick Davies

unread,
Jan 11, 2005, 7:58:58 AM1/11/05
to
* Aquila <brae...@netscape.net> [0156 12:56]:

> Is there a place where I can find information on using mod_ruby? A single
> stupid example will do, I just can't find anything...

http://www.modruby.net ?

> I guess once I get mod_ruby working rails will work too? I don't find any
> information on that combination either.
>
> I'm anxious to start using rails!

you don't need modruby to use rails.

--
'Oh how awful. Did he at least die peacefully? ....To shreds you say, tsk tsk tsk.
Well, how's his wife holding up? ....To shreds, you say...'
-- Prof. Farnsworth
Rasputin :: Jack of All Trades - Master of Nuns


Aquila

unread,
Jan 11, 2005, 10:48:24 AM1/11/05
to
Dick Davies wrote:

>> Is there a place where I can find information on using mod_ruby? A single
>> stupid example will do, I just can't find anything...
>
> http://www.modruby.net ?
>

It will probably be my fault but I can't find any example on modruby.net? I
really can't find a complete script...

>> I guess once I get mod_ruby working rails will work too? I don't find any
>> information on that combination either.
>>
>> I'm anxious to start using rails!
>
> you don't need modruby to use rails.

But if I prefer not to use CGI I read it's possible to use Rails with
mod_ruby. Or am I misinformed?

Brian McCallister

unread,
Jan 11, 2005, 11:10:35 AM1/11/05
to
You can use it with mod_ruby. I think FastCGI is probably used more
(happens to be what I use as well) and is quite performant.

-Brian

Sarah Tanembaum

unread,
Jan 11, 2005, 4:29:51 PM1/11/05
to
Using the mod_ruby gives web application more bags of tools that comes
with Apache, just like the mod_php. And also, it is easier to manage
since it is integrated with Apache.

Some have claimed that FastCGI is faster than mod_ruby, can anyone
validate these claims? Because I can hardly believe that CGI is faster
than the embedded interpreter.

Thanks

David Heinemeier Hansson

unread,
Jan 11, 2005, 5:14:41 PM1/11/05
to
> Using the mod_ruby gives web application more bags of tools that comes
> with Apache, just like the mod_php. And also, it is easier to manage
> since it is integrated with Apache.
>
> Some have claimed that FastCGI is faster than mod_ruby, can anyone
> validate these claims? Because I can hardly believe that CGI is faster
> than the embedded interpreter.

mod_ruby uses one interpreter per Apache process, which means that apps
walk all over each other in the namespaces. At least for Rails, that's
not acceptable, so it's 1 app per Apache setup if you want mod_ruby.

FCGI is a much better setup for Rails. You don't fill up a ton of
Apache processes with your app (so apache processes serving static
files and images stay small) and you can have as many apps per apache
setup as you'd like.

I've found FCGI to be 10-15% faster in my tests with Rails.
--
David Heinemeier Hansson,
http://www.basecamphq.com/ -- Web-based Project Management
http://www.rubyonrails.org/ -- Web-application framework for Ruby
http://macromates.com/ -- TextMate: Code and markup editor (OS X)
http://www.loudthinking.com/ -- Broadcasting Brain

James Britt

unread,
Jan 11, 2005, 9:49:35 PM1/11/05
to
Sarah Tanembaum wrote:
> Using the mod_ruby gives web application more bags of tools that comes
> with Apache, just like the mod_php. And also, it is easier to manage
> since it is integrated with Apache.
>
> Some have claimed that FastCGI is faster than mod_ruby, can anyone
> validate these claims? Because I can hardly believe that CGI is faster
> than the embedded interpreter.

I believe this is because FastCGI keeps one or more Ruby interpreters in
memory, rather than creating a new process on each Web request.

Bear in mind that with mod_ruby, all Web applications are sharing the
same interpreter, and the same object space.

James


Aquila

unread,
Jan 12, 2005, 7:39:01 AM1/12/05
to
Aquila wrote:

> Is there a place where I can find information on using mod_ruby? A single
> stupid example will do, I just can't find anything...

Doesn't anyone use mod_ruby then? Does everyone use Rails? There must be
some example lying around somewhere...

Thanks for your help and ruby!

Jeffrey Dik

unread,
Jan 12, 2005, 12:42:52 PM1/12/05
to
On Wed, Jan 12, 2005 at 09:41:17PM +0900, Aquila wrote:
> Aquila wrote:
>
> > Is there a place where I can find information on using mod_ruby? A single
> > stupid example will do, I just can't find anything...
>
> Doesn't anyone use mod_ruby then? Does everyone use Rails? There must be
> some example lying around somewhere...

There's mod_ruby examples on:
http://www.modruby.net/en/doc/?FAQ
but perhaps
http://sean.chittenden.org/programming/ruby/mod_ruby/apachecon-2002/mod_ruby_intro.html
would be more useful.

I have been using rails with mod_ruby, but have been getting some
transient errors. I just switched to using mod_fastcgi, and so far it
seems to be both faster and error-free.

HTH,
Jeff

David Garamond

unread,
Jan 13, 2005, 6:30:28 AM1/13/05
to
Aquila wrote:
>>Is there a place where I can find information on using mod_ruby? A single
>>stupid example will do, I just can't find anything...
>
> Doesn't anyone use mod_ruby then? Does everyone use Rails? There must be
> some example lying around somewhere...

mod_ruby doesn't have to be used to create a webapp, you know :-) I use
mod_ruby to customize & extend Apache behaviour (e.g. custom URL
mapping, URL filtering, and flexible wrapped CGI execution). It's so
much easier and faster using Ruby to create Apache modules instead of C.

Oh and I use plain Ruby CGI and FastCGI too.

--
dave


Aquila

unread,
Jan 13, 2005, 7:25:07 AM1/13/05
to
David Garamond wrote:

> mod_ruby doesn't have to be used to create a webapp, you know :-)

I don't understand it, you need some sort of layer on top of apache to use
server sided scripting with apache, and if you don't you can use webrick or
some other stand alone http server, right?

> I use
> mod_ruby to customize & extend Apache behaviour (e.g. custom URL
> mapping, URL filtering, and flexible wrapped CGI execution). It's so
> much easier and faster using Ruby to create Apache modules instead of C.
>

You are writing your own mod_filtering etc? That sounds really interesting.
Can I find your code somewhere?

> Oh and I use plain Ruby CGI and FastCGI too.

By plain Ruby CGI you mean Ruby on top of "regular" Apache CGI?
To end a message from a confused person: I do understand what you mean by
FastCGI...

Thanks for the information!

David Garamond

unread,
Jan 13, 2005, 1:32:43 PM1/13/05
to
Aquila wrote:
>>mod_ruby doesn't have to be used to create a webapp, you know :-)
>
> I don't understand it, you need some sort of layer on top of apache to use
> server sided scripting with apache, and if you don't you can use webrick or
> some other stand alone http server, right?

What I meant was that, mod_ruby is a tool that binds Ruby to Apache. You
can of course use mod_ruby to create web applications (i.e. generate
dynamic HTML/XHTML pages with Ruby interpreter embedded inside Apache).
But you can also use mod_ruby for other purposes than generating dynamic
pages (e.g. for an admin like me, mod_ruby makes Apache more useful
because I can extend it easily with Ruby code. This way Ruby works
behind the layer and doesn't always have anything to do page generation
at all).

So it's not always appropriate to compare mod_ruby with FastCGI or even
rails. They do different things.

>>I use
>>mod_ruby to customize & extend Apache behaviour (e.g. custom URL
>>mapping, URL filtering, and flexible wrapped CGI execution). It's so
>>much easier and faster using Ruby to create Apache modules instead of C.
>
> You are writing your own mod_filtering etc? That sounds really interesting.
> Can I find your code somewhere?

Sorry, much of it is internal stuffs. I used to use mod_perl though, and
there are many examples (even books) for that. Most of them can be
applied pretty easily for mod_ruby too.

>>Oh and I use plain Ruby CGI and FastCGI too.
>
> By plain Ruby CGI you mean Ruby on top of "regular" Apache CGI?

Yes. (It doesn't always have to be Apache, of course. CGI is a generic
protocol that's supported by most webservers).

> To end a message from a confused person: I do understand what you mean by
> FastCGI...
>
> Thanks for the information!

You're welcome!

--
dave


Sarah Tanembaum

unread,
Jan 13, 2005, 2:31:25 PM1/13/05
to
I too like to see more application in mod_ruby/eruby and take advantage
of rich features that came in with Apache. I came from the PHP camp,
which has worked for me for both the Linux, Solaris, and Windows
platform beautifully, and mod_ruby would do a better job since the
language itself, Ruby, is, IMO, a better language than PHP.

But, I always hit a snag in Windows implementation of mod_ruby. Until
recently that someone is nice enough to work it out on Windows,
therefore I can explore more of mod_ruby/eruby.

Just an FYI, there are a newsgroup dedicated to mod_ruby,
gmane.comp.apache.mod-ruby
gmane.comp.editors.mod-ruby.devel
...

Just my 2 cents.

Sarah

Michael Granger

unread,
Mar 4, 2005, 10:54:41 AM3/4/05
to
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Jan 12, 2005, at 7:41 AM, Aquila wrote:

> Aquila wrote:
>
>> Is there a place where I can find information on using mod_ruby? A
>> single
>> stupid example will do, I just can't find anything...
>
> Doesn't anyone use mod_ruby then? Does everyone use Rails? There must
> be
> some example lying around somewhere...

I've written a humble little framework around mod_ruby called Arrow:

http://www.rubycrafters.com/projects/Arrow/

It has neither the developer resources nor groundswell of interest that
Rails does, but I find it quite useful.

- --
Michael Granger <g...@FaerieMUD.org>
Rubymage, Believer, Architect
The FaerieMUD Consortium <http://www.FaerieMUD.org/>
ruby -e "p 12383406064495388618631689469409153107.to_s(36).tr('z',' ')"
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (Darwin)

iD8DBQFCKISt+zlz4UKpE6QRArqZAKCCh59DeGA3WKS6exETcxZTRnrE3ACgj41S
GcUiswyy1TuSKXLoHCjAavo=
=68c6
-----END PGP SIGNATURE-----

Reply all
Reply to author
Forward
0 new messages