HTTPd running with many PID!!! slow down server!

wchost

Verified User
Joined
Aug 2, 2003
Messages
51
Hello

I have server freshly install Fedora Core 2 onto following machine
- P4 2.8GE
- i865GE Intel desktop motherboard
- 2x 512MB DDR400 Ram Dual Channel
- 120GB SATA Harddisk

Then I install DirectAdmin, and free of error.

Then..I restore the files only from the ex-machine...and start it up...it works!

But then when I see httpd and mysql queries...it jumped to 30 seconds to query 5 queries.

Compare with the Celeron with no optimize..it performs way better

The photo attached..is the print screen of the top of that machine....and as you can see the Apache is performing in a weird way. It creates a process for every 1 access to the website. Same as MySQL!

Could anyone figure it out and what i should to do fix it?

Thanks
 

Attachments

  • mcy-top.gif
    mcy-top.gif
    16.9 KB · Views: 859
Personally that is not near a high load, to me thats near idle. All of the idle httpd processes are waiting for requests to be used.
That picture you posted shows that 97.7% cpu is idle which not not really a load if you have quite a few websites loaded on your server.
I have around 100 processes constantly where on average 95 are idle so your server load looks normal :)


If MySQL is operating slow with that kind of load it might not be configured properly or optimized for your server.
 
nono, did you see the Apache respawning it self so much?
only one person enter that site!
 
If one person entered the site you're seeing exactly as many processes as you're supposed to see.

here's a snippet from the /etc/httpd/conf/httpd.conf log which explains it:
Code:
# Server-pool size regulation.  Rather than making you guess how many
# server processes you need, Apache dynamically adapts to the load it
# sees --- that is, it tries to maintain enough server processes to
# handle the current load, plus a few spare servers to handle transient
# load spikes (e.g., multiple simultaneous requests from a single
# Netscape browser).
#
# It does this by periodically checking how many servers are waiting
# for a request.  If there are fewer than MinSpareServers, it creates
# a new spare.  If there are more than MaxSpareServers, some of the
# spares die off.  The default values are probably OK for most sites.
#
MinSpareServers 5
MaxSpareServers 20

Jeff
 
Server looks like it's running very fast, top is the most CPU intensive program you have:)
 
This is bad isn't it?????

15:55:00 up 8 days, 1:13, 1 user, load average: 0.19, 0.13, 0.04
84 processes: 82 sleeping, 2 running, 0 zombie, 0 stopped
CPU states: 0.1% user 0.7% system 0.0% nice 0.0% iowait 99.0% idle
Mem: 1022812k av, 976424k used, 46388k free, 0k shrd, 85552k buff
685396k actv, 300k in_d, 21044k in_c
Swap: 2040244k av, 2980k used, 2037264k free 732976k cached


and check out mysql:

4 apache 16 0 15876 15M 10708 S 3.3 1.5 0:02 0 httpd
9730 mail 15 0 492 492 176 S 0.1 0.0 0:00 0 exim
10040 mysql 15 0 66280 64M 1512 S 0.1 6.4 1:49 0 mysqld
28496 root 15 0 1184 1184 860 R 0.1 0.1 0:01 0 top
28715 apache 15 0 15096 14M 10592 S 0.1 1.4 0:00 0 httpd


are numbers this high normal
 
Those numbers don't look bad to me unless you don't have a single user using your server ;)
 
just me as far as i know! and maybe a couple hits here and there. I get less then a gig of traffic to my server everymonth with 4 sites on it!

what concerns me is i am almost outta RAMdo i need even more than a gig...dayem!
 
That is still normal ;)

If this is really bugging you then just modify the httpd.conf file to have a lower number of idle proccesses around, but might mean slower performance if usage spikes.

Here are my stats with only two other users, using maybe 10gb at the most a month so far

last pid: 3106; load averages: 0.07, 0.04, 0.00 up 0+02:38:07 23:09:59
90 processes: 1 running, 89 sleeping
CPU states: 0.4% user, 0.0% nice, 0.8% system, 0.8% interrupt, 98.1% idle
Mem: 214M Active, 180M Inact, 80M Wired, 21M Cache, 60M Buf, 3512K Free
Swap: 1024M Total, 300K Used, 1024M Free

It really depends on how you use your server that determines its load.
 
vincenzobar said:
what concerns me is i am almost outta RAMdo i need even more than a gig...dayem!
You are NOT out of memory. Linux will use memory as it needs to, then keep that memory "in use" marked as to when it was last used. So after it runs a while, all Linux systems will look as if most of their memory is in use.

But when you need more memory, Linux will free up the last used unneeded memory instantly.

What you're seeing is normal Linux memory management procedure.

Jeff
 
I would also like to address the original posters concerns about "too many" Apache and MySQL processes.

I have a feeling you were probably running RH 7.3 on your old server. Our old shared hosting server was running 7.3 and did not show "child" processes in top. All we would see was the parent httpd process and the parent mysqld process. In RH 9 and RHEL 3 we see ALL child process seperately.

So while you might not have seen them in top before, they were there.

As an compliment to this point, here are some brief stats from our new shared server:

top output
Code:
 13:46:02  up 2 days,  3:55,  2 users,  load average: 0.04, 0.13, 0.10
139 processes: 138 sleeping, 1 running, 0 zombie, 0 stopped
CPU states:  cpu    user    nice  system    irq  softirq  iowait    idle
           total    6.8%    0.0%    2.8%   0.0%     0.4%    5.6%  383.2%
           cpu00    0.9%    0.0%    0.9%   0.0%     0.5%    1.7%   95.6%
           cpu01    0.5%    0.0%    0.7%   0.1%     0.0%    1.1%   97.2%
           cpu02    2.7%    0.0%    0.5%   0.0%     0.0%    1.5%   95.0%
           cpu03    2.7%    0.0%    0.5%   0.0%     0.0%    1.1%   95.4%
Mem:  1028448k av, 1002172k used,   26276k free,       0k shrd,   50212k buff
                    734024k actv,   89424k in_d,   14476k in_c
Swap: 2096472k av,   40320k used, 2056152k free                  659376k cached

  PID USER     PRI  NI  SIZE SWAP  RSS SHARE STAT %CPU %MEM   TIME CPU COMMAND
 9095 apache    16   0 15912  644  14M  8268 S     2.5  1.4   0:00   3 httpd
14045 apache    16   0 15224  644  14M  8240 S     2.1  1.4   0:00   2 httpd
14090 apache    18   0 13852  644  12M  8068 S     0.3  1.2   0:00   0 httpd
 9882 apache    15   0 13948  644  12M  8080 S     0.1  1.2   0:00   0 httpd
 9898 apache    15   0 16512  644  15M  8236 S     0.1  1.5   0:00   1 httpd
14016 apache    15   0 15396  644  14M  8204 S     0.1  1.4   0:00   1 httpd
 2782 apache    15   0 13296  644  12M  7692 S     0.0  1.2   0:00   0 httpd
 7550 apache    15   0 13856  644  12M  8072 S     0.0  1.2   0:00   3 httpd
 8154 apache    15   0 15376  644  14M  8268 S     0.0  1.4   0:00   0 httpd
 9191 apache    15   0 16500  644  15M  8240 S     0.0  1.5   0:00   1 httpd
10045 apache    15   0 13300  644  12M  7692 S     0.0  1.2   0:00   3 httpd
10052 apache    15   0 16364  644  15M  8288 S     0.0  1.5   0:00   1 httpd
14057 apache    15   0 14720  644  13M  8148 S     0.0  1.3   0:00   2 httpd
14080 apache    15   0 13296  644  12M  7692 S     0.0  1.2   0:00   0 httpd
14092 apache    15   0 13220  648  12M  7640 S     0.0  1.2   0:00   0 httpd
14093 apache    15   0 13220  648  12M  7640 S     0.0  1.2   0:00   1 httpd

Notice all the apache processes?

Now from Apache's server status report:
Code:
Current Time: Wednesday, 18-Aug-2004 13:46:43 CDT
Restart Time: Wednesday, 18-Aug-2004 08:36:08 CDT
Parent Server Generation: 0
Server uptime: 5 hours 10 minutes 35 seconds
Total accesses: 56144 - Total Traffic: 2.6 GB
CPU Usage: u7.96 s1.29 cu.03 cs.01 - .0499% CPU load
3.01 requests/sec - 147.8 kB/second - 49.1 kB/request
11 requests currently being processed, 5 idle servers

11 active request and 5 idle servers equals 16 total processes. Which is what we were shown in the top output.

So what you are seeing is completely normal.
 
I seem to have similar problems with the Apache server processes.

My CPU load is between 0 and 4% but pages won't get displayed becase Apache has reached it's maximum number of processes. This while there (should be) very little traffic (1am).

Some more info... I recently installed SpamAssassin and ClamAV, following the instructions in the HOWTO section. This does not seem to be the problem as there were no problems until now (5 days after install).

--------------------

Above is what I was busy typing in reply to this Topic.

The problem I now know is a DoS attack on the HTTP service. I have had about 189,000,000 HTTP SEARCH requests in the past 20 hours from 35 different IPs (mostly annonymous proxies). The average is about 75 requests per second per IP.

In this post you can read more about possible counter measures for this type of attack...

Kind Regards,
Onno Vrijburg
 
I also found some useful information in other forums.

Your server can also seem to slow down because the maximum number of processes have been reached. This can happen on busy servers.

The answer is to add ulimit statements to the /etc/profile (this will only work for root but then you can at least access your server) and to set the ulimits per user in the /etc/security/limits.conf. The default for RH9 is 256 processes, I believe (but have not found this yet) is that the default number of open files is 512.

I have changed these values to 1024 processes and 3072 open files for the user apache. The httpd process starts and runs under the user root but all spawned processes are run under the users apache. For mySQL the user is mysql.

Please note that my RH9/DA box reports a DNS error when the apache server has reached it's maximum number of connections. This will continue until one of the Apache processes becomes available again.

Well that's my 2c worth....

Kind regards,
Onno Vrijburg
 
Back
Top