Return-Path: Delivered-To: apmail-httpd-modules-dev-archive@locus.apache.org Received: (qmail 28644 invoked from network); 23 Mar 2007 17:02:46 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 23 Mar 2007 17:02:46 -0000 Received: (qmail 51104 invoked by uid 500); 23 Mar 2007 17:02:53 -0000 Delivered-To: apmail-httpd-modules-dev-archive@httpd.apache.org Received: (qmail 51084 invoked by uid 500); 23 Mar 2007 17:02:53 -0000 Mailing-List: contact modules-dev-help@httpd.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: modules-dev@httpd.apache.org Delivered-To: mailing list modules-dev@httpd.apache.org Received: (qmail 51075 invoked by uid 99); 23 Mar 2007 17:02:53 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 23 Mar 2007 10:02:53 -0700 X-ASF-Spam-Status: No, hits=2.7 required=10.0 tests=RCVD_IN_SBL,SPF_HELO_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: local policy) Received: from [216.138.240.12] (HELO mail.acerenting.com) (216.138.240.12) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 23 Mar 2007 10:02:41 -0700 Received: from HP72472929110 (unknown [216.130.212.102]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) by mail.acerenting.com (Postfix) with ESMTP id 3E4BE1580043 for ; Fri, 23 Mar 2007 13:02:55 -0400 (EDT) Message-ID: <018a01c76d6c$f30dec60$66d482d8@HP72472929110> Reply-To: "Danie Qian" From: "Danie Qian" To: References: <072201c76c85$06861850$66d482d8@HP72472929110> <20070322134627.4d8b8bf5@grimnir> <076001c76c96$b5a7b670$66d482d8@HP72472929110> <953017480703221018u64d6ed46n765ba7492806755f@mail.gmail.com> <00ba01c76cec$e0812470$66d482d8@HP72472929110> <5280fae50703230834m3b5354f0g5f227650fbb05686@mail.gmail.com> Subject: Re: load data at server startup - is ap_hook_post_config() the right place? Date: Fri, 23 Mar 2007 13:01:50 -0400 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="gb2312"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.3028 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028 X-Virus-Checked: Checked by ClamAV on apache.org ----- Original Message ----- From: "David Wortham" To: ; "Danie Qian" Sent: Friday, March 23, 2007 11:34 AM Subject: Re: load data at server startup - is ap_hook_post_config() the right place? > Daniel, > I believe (I am a module programmer with only novice Apache API > experience) that there are quite a few server configs created. > > From my experiments with my module, there appear to be at least two > running all the time (what appears to be a "global" server config and one > server config for every virtualhost defined in httpd.conf and other config > files). > > Also, I would guess that each child process has their own copy of the > server configs. > I believe this because every time a server_config_merge function is > called, > the server config is edited. > The server_config_merge function is run at server startup (based on > httpd.conf settings) and again at the beginning of a request (when > .htaccess > files are parsed... although I am not sure why). > AFAIK, every time a "variable" in the parent process is written to by a > child process, the child process is given a copy of the parent's variable > and only that copy (in the child process) is edited. > By that logic, I would think that not only do you potentially get one > server_config struct per (child process which writes to the server > config), > but each server_config_struct is independently modified by each child > process (on potentially different). > > Maybe this page can shed some light on your questions: > http://www.fmc-modeling.org/projects/apache/html/3_3Extending_Apache.html > > > Regards, > Dave > > > -- > David Wortham > Senior Web Applications Developer > Unspam Technologies, Inc. > 1901 Prospector Dr. #30 > Park City, UT 84060 > (435) 513-0672 > > > On 3/22/07, Danie Qian wrote: >> >> >> ----- Original Message ----- >> From: "Dumindu Perera" >> To: ; "Danie Qian" >> >> Sent: Thursday, March 22, 2007 1:18 PM >> Subject: Re: load data at server startup - is ap_hook_post_config() the >> right place? >> >> Thanks for replying. Does every child process has one copy of the server >> config or is there only one copy in the whole server memory space? I dont >> want every child to have a copy as the config data is quite big in my >> case. >> >> Best Regards, >> Daniel >> >> > Hi Dave, I think you are right after piecing together all the information I gathered from various places. As soon as a child process modify the data in the server config created by the parent server, the child gets a copy of it. This is ok if the server config is only a few httpd.conf directives but in my case it would be very inefficient as the table to be put in server config can grow to a few hundred Kilobytes. At this point child processes arent required to dynamically change anything in the server config but I dont feel comfortable to put in it being aware of the above fact. Someone in the forum mentioned about mutex for this situaction. Now i have one question: mutex is a multithread thing but if I run apache in single-thread mode like prefork is it still the best solution? Thanks, Daniel