Solaris / OpenSolarisThis forum is for the discussion of Solaris, OpenSolaris, OpenIndiana, and illumos.
General Sun, SunOS and Sparc related questions also go here. Any Solaris fork or distribution is welcome.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Can somebody help me with this Apache configuration?
My machine's CPU processing is always overloading after each one day I restarted the Apache.
I already tried to google about apache tuning and found a few tips which I already applied. Here are some of the httpd.conf configuration that I changed :
My website is running mostly dynamic content (php,flash, and Oracle). When the CPU process is above 90%, I found many httpd process status is sleep while they still consume the CPU and memory. Why is that happening? How could I destroy the process with sleep status automatically? Do I miss something in the configuration?
Our machine is running SPARC Solaris 10 and having 8 GB physical RAM and 16 GB swap.
I would like to limit the httpd process so that they wouldn't run untill the CPU process is > 90%. I should limit it by the MaxClients directive, shouldn't I? But the problem is eventhough I tried to lower the MaxClients allowed, there are usually many stalled httpd process that make the CPU load is always high.
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789
Rep:
Quote:
Originally Posted by romeo_tango
When the CPU process is above 90%, I found many httpd process status is sleep while they still consume the CPU and memory. Why is that happening? How could I destroy the process with sleep status automatically?
There is no reason to kill a process just because it has been sampled in the sleeping state. All processes do sleep at some time.
Quote:
But the problem is eventhough I tried to lower the MaxClients allowed, there are usually many stalled httpd process that make the CPU load is always high.
They aren't stalled but runaway processes, as they load the CPU.
You should use prstat and vmstat on Solaris, top is known to have some issues.
You can run pstack and/or truss on these processes to see what they are actually doing.
Can somebody help me with this Apache configuration?
There is nothing wrong with (that part of) your httpd.conf.
Check Apache's access.log and error.log for some correlations with the things you 've found in prtstat (see above). Some misconfigured Apache modules may be misbehaving.
There is no reason to kill a process just because it has been sampled in the sleeping state. All processes do sleep at some time.
They aren't stalled but runaway processes, as they load the CPU.
You should use prstat and vmstat on Solaris, top is known to have some issues.
You can run pstack and/or truss on these processes to see what they are actually doing.
yeah i know that the processes is using CPU, that's what I am asking. I mean, i don't know how to keep this Apache run stable.
Here is the capture from prstat when the CPU is 90% busy :
and to be honest.. i don't really understand the information from pstack output.
if I change the question, why the highest httpd process consume up to 44% of the CPU load? can I limit so it would not be so greedy? I changed the MaxClients directive and its friends but the result is still the same.
There is nothing wrong with (that part of) your httpd.conf.
Check Apache's access.log and error.log for some correlations with the things you 've found in prtstat (see above). Some misconfigured Apache modules may be misbehaving.
Thanks, C
i can't find any correlations between the error.log and prstat.. my error.log mainly contains these lines :
Code:
[Fri Jan 04 15:48:37 2008] [error] [client 20x.xxx.xxx.128] Directory index forbidden by rule:
that should be happened because the .htaccess directive shouldn't it?
Last edited by romeo_tango; 01-04-2008 at 03:08 AM.
that one is for the above httpd running consume 44% of the CPU...
and to be honest.. i don't really understand the information from pstack output.
I believe your process is busy processing some PHP code and is currently trying to allocate some memory for an array variable that is growing.
You need to run pstack a couple of times more to see where exactly the process is stuck looping. I'm not at all familiar with PHP but it could be a memory leak or something similar.
Quote:
if I change the question, why the highest httpd process consume up to 44% of the CPU load?
Because it has some code to execute. It would probably consume 100% should the CPU was fully available.
Quote:
can I limit so it would not be so greedy?
If it is busy processing something useful and it should be given the CPU it requires.
If it is stuck because of a bug or bad design, you can suspend the busy processes (pstop PID) and see if the service is still provided correctly.
i can't find any correlations between the error.log and prstat.. my error.log mainly contains these lines :
Code:
[Fri Jan 04 15:48:37 2008] [error] [client 20x.xxx.xxx.128] Directory index forbidden by rule:
that should be happened because the .htaccess directive shouldn't it?
I can't say yes or no to that, since I don't know the rest of your httpd.conf or the Apache modules that you are using.
Back to the memory swallowing Apache problem:
this can be caused by any bad programmed PHP application or any thread unsafe PHP library that is used by PHP applications.
I suggest you shut down Apache modules one by one (restart the Apache webserver every time!) and see what happens with the memory usage.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.