Apache with Ruby: Several questions

H

Hadmut Danisch

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
 
C

Carl Youngblood

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?UsingRubyFastCGI

Carl Youngblood
 
H

Hadmut Danisch

Carl said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,141
Messages
2,570,813
Members
47,357
Latest member
sitele8746

Latest Threads

Top