httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Danie Qian" <>
Subject Re: load data at server startup - is ap_hook_post_config() the right place?
Date Fri, 23 Mar 2007 17:01:50 GMT

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


View raw message