From: Bill Kelly Date: 2003-01-24T07:31:10+09:00 Subject: Re: mod_ruby: what's persistent and what's shared? Hi, From: "Ollivier Robert" > > Imagine you do something like this in your httpd.conf > > -=-=- > RubyRequire common-data > -=-=- > > and that in common-data.rb you have this: > > -=-=- > require 'dbi' > > $DB = DBI.connect("dbi:mysql:foodb", "user", "password") > -=-=- > > Will all instances of httpd share the same $DB ? Remember that it is not > data created by a script or a .rhtml page, it is data created when you > start the httpd server... My guess is that this would be problematic. Forked children do inherit copies of the parent's file handles (I'm assuming a DB connection is at its heart a file handle / socket?) My guess as to what would happen would be that the child http processes would indeed probably "share the same $DB", assuming the http.conf processing happens before the children are forked. However, I think it would likely be a problem to have the child processes all chattering simultaneously at the DB over the same connection. I wouldn't expect that to work properly. (But I don't know how it's implemented, so I could be wrong.) Regards, Bill