You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Ryan Hansen <rh...@idiglobal.com> on 2005/12/07 19:37:49 UTC

[users@httpd] environment variables and CPU usage

Greetings,

I couldn't find any specific information out there about this issue, 
likely because it's probably not being done by many other 
organizations.  I'm new to this company, which is a PHP/Oracle web app 
firm using an ASP-type buisness model.

To minimize impact and improve performance on dynamic, db-driven apps, 
the original developers designed the system to use Apache environment 
variables to store information that would otherwise have been stored in 
the database (file paths, file names, etc.).  To accomplish this, each 
Virtual Host has a separate associated include file that contains 
anywhere from 10 to X Apache environment variable declarations.  At 
first glance, this seems like a clever way to handle some of the dynamic 
data, but I've had my reservations about this method, not knowing what 
the long-term side-effects would be.

I found one serious side-effect today: it seems that when you get to a 
certain number of vhosts (each with it's own set of env vars), 
restarting Apache takes up to 15 minutes to complete (on FC3, Dell 
PowerEdge Dual Pentium III 1Ghz with 1GB memory).  During restart, one 
of the two procs was spiked up to 99%, but the memory was relatively 
untouched.  Once Apache was finally running, the CPU spike dropped 
backed to normal.  This problem did not exist prior to adding a few very 
large web sites to the server recently.  Needless to say,  a 15+ minute 
restart time is unacceptable.

So, my questions are the following:

1- Does someone with a much lower level understanding of Apache know if 
the envrionment variables could actually be the cause of this problem, 
or should I look elsewhere?  I'm not asking for a complete diagnostic 
evaluation, just a note to say whether or not I'm barking up the wrong tree.

2- If the environment variable situation is likely the core of the 
problem (as I believe), can someone give a more specific explanation as 
to why, so I can convince the designers of this system that it's a 
"less-effective" design?

Sorry for the verbose message.

Thanks to those who are smarter than I.
-Ryan

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] environment variables and CPU usage

Posted by Joshua Slive <js...@gmail.com>.
On 12/7/05, Ryan Hansen <rh...@idiglobal.com> wrote:
> To minimize impact and improve performance on dynamic, db-driven apps,
> the original developers designed the system to use Apache environment
> variables to store information that would otherwise have been stored in
> the database (file paths, file names, etc.).  To accomplish this, each
> Virtual Host has a separate associated include file that contains
> anywhere from 10 to X Apache environment variable declarations.  At
> first glance, this seems like a clever way to handle some of the dynamic
> data, but I've had my reservations about this method, not knowing what
> the long-term side-effects would be.

It is unclear exactly what you are talking about.  Some actual
configuration examples would be very helpful.

>
> I found one serious side-effect today: it seems that when you get to a
> certain number of vhosts (each with it's own set of env vars),
> restarting Apache takes up to 15 minutes to complete (on FC3, Dell
> PowerEdge Dual Pentium III 1Ghz with 1GB memory).  During restart, one
> of the two procs was spiked up to 99%, but the memory was relatively
> untouched.  Once Apache was finally running, the CPU spike dropped
> backed to normal.  This problem did not exist prior to adding a few very
> large web sites to the server recently.  Needless to say,  a 15+ minute
> restart time is unacceptable.
>
> So, my questions are the following:
>
> 1- Does someone with a much lower level understanding of Apache know if
> the envrionment variables could actually be the cause of this problem,
> or should I look elsewhere?  I'm not asking for a complete diagnostic
> evaluation, just a note to say whether or not I'm barking up the wrong tree.

Evaluating SetEnv directives should be quite fast.  If you have many
thousands of them it might start to slow things down, but I doubt it
explains a 15 minute start time.

>
> 2- If the environment variable situation is likely the core of the
> problem (as I believe), can someone give a more specific explanation as
> to why, so I can convince the designers of this system that it's a
> "less-effective" design?

You need to give a more specific example as I mentioned above.

I suggest starting "httpd -X" under strace or a debugger to see what
it is actually doing for all that time.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org