[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ruby-talk
Subject:    Re: DBI and mod_ruby
From:       Idan Sofer <idan () idanso ! dyndns ! org>
Date:       2002-12-30 21:51:31
[Download RAW message or body]

Tom Sawyer wrote:

>working on a cgi app and i'm using a module with a module varaible (@@) to 
>persist a DBI connection across http requests.
>
>now, i had been opening and closing the connection with each request, but that 
>is obviously overhead that i don't need. i should be able to put the 
>peristance that mod_ruby allows to good use.
>
I'm not sure if this is wise.

Correct me if I'm wrong, but mod_ruby, like any apache mod, is running 
in-process and as such, it's behaviour depends on the apache process.

Since Apache 1.3(with the exception of the NT port perhaps) is a forking 
server, then every server child is basicly has a seperate Ruby 
enviroment(althought initially shared due to copy-on-write mechanism).

So I assume modifying the module variable as done in one apache instance 
shall not affect the others, that can be potentially a source of trouble 
perhaps.

If you wish to have real persistence, DB Pools etc perhaps you should 
consider writing it as FastCGI.

Nevertheless it is very much possible all I said here is total nonsense, 
and soon I'm gonna be flooded with flames and RTFM style messages, but I 
hope that is not the case:-)

Idan


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic