[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Apache with Ruby: Several questions

Hadmut Danisch

11/23/2003 2:00:00 PM

Hi,

I'd like to migrate an old Apache/PHP/Perl application to Ruby, and
I do have some question:

- PHP supports persistent MySQL connections, so it does not need
to reopen the connection for every single Web access.

Is there a way to do this in Ruby?


- Apache maintains several processes, and subsequent requests
are handled by different processes. An efficient way for
interprocess-Communication is required.

Perl has a module which allows to put a Hash into a shared
memory segment.

Does ruby support something similar?

regards
Hadmut

2 Answers

Carl Youngblood

11/23/2003 4:12:00 PM

0

The best way that I know of accomplishing all the things you just
described is Apache with Ruby and mod_fastcgi. The fcgi ruby module is
designed so that you write your script to loop over a series of HTTP
requests while everything stays in memory. This means that the database
connection you open at the beginning stays in memory and is accessible
to all of your requests and that memory sharing is just built in.

Here is a page with more information:

http://www.rubygarden.org/ruby?UsingR...

Carl Youngblood

Hadmut Danisch wrote:
> Hi,
>
> I'd like to migrate an old Apache/PHP/Perl application to Ruby, and
> I do have some question:
>
> - PHP supports persistent MySQL connections, so it does not need
> to reopen the connection for every single Web access.
>
> Is there a way to do this in Ruby?
>
>
> - Apache maintains several processes, and subsequent requests
> are handled by different processes. An efficient way for
> interprocess-Communication is required.
>
> Perl has a module which allows to put a Hash into a shared
> memory segment.
>
> Does ruby support something similar?
>
> regards
> Hadmut
>

Hadmut Danisch

11/26/2003 9:38:00 PM

0

Carl Youngblood wrote:

> The best way that I know of accomplishing all the things you just
> described is Apache with Ruby and mod_fastcgi. The fcgi ruby module is
> designed so that you write your script to loop over a series of HTTP
> requests while everything stays in memory. This means that the database
> connection you open at the beginning stays in memory and is accessible
> to all of your requests and that memory sharing is just built in.


Yup, thanks for the hint, that's exactly what I was looking for.

I still have a slight problem with the current fcgi library and ruby1.8:

The cgi object generated with

each_cgi { |cgi|

is of class CGI, but this is not the same as the common CGI
class, so it does not provide functions like .h1 or .html

Is this a bug or intentional?

Hadmut