httpd memory usage high

Support for webhosts that use CentOS
Post Reply
shavenlunatic
Posts: 7
Joined: 2008/05/12 10:17:22

httpd memory usage high

Post by shavenlunatic » 2008/05/12 10:30:01

Hi,

I use linux on my desktop but I'm still learning.. but I'm a total noob when it comes to running a remote dedicated server with only SSH access, so if I'm asking a stupid question and/or a question that's been asked a million times, I apologise, I didn't manage to find anything which I noticed as able to help me.

I have a web server set up with Centos 5, Apache [edit: Server version: Apache/2.2.3], PHP & MySQL. A Celeron D 2.0 Ghz CPU 1GB DDR and a 10Mbps virtual pipe.

The site is not active yet and has no traffic (waiting for domains to switch) but what concerns me is that it takes forever to to a cache-free refresh of a page hosted on the server (we are currently on a shared web server, in the processing of moving to increase speed and the new dedicated server is slower.. much much slower)

I'm not sure where to start but one thing I've noticed is that httpd is sucking up about 50% of my memory (and as I mentioned, nobody but me is accessing the site so it's not really 'working hard' so to speak)

I have grabbed the top 16 processes of TOP (sorted by memory usage)

[code]
Tasks: 80 total, 2 running, 78 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.0%us, 0.0%sy, 0.0%ni,100.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 1035208k total, 500392k used, 534816k free, 144480k buffers
Swap: 2031608k total, 0k used, 2031608k free, 238752k cached

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
2732 root 15 0 40884 27m 3484 S 0.0 2.7 4:02.45 yum-updatesd
2456 mysql 15 0 135m 19m 3832 S 0.0 2.0 0:00.25 mysqld
12371 apache 15 0 30796 12m 3212 S 0.0 1.3 0:00.13 httpd
2537 root 18 0 25552 11m 7156 S 0.0 1.2 0:00.18 httpd
12362 apache 15 0 29180 11m 3232 S 0.0 1.1 0:00.16 httpd
12363 apache 15 0 29184 11m 3188 S 0.0 1.1 0:00.15 httpd
12372 apache 15 0 29088 11m 3232 S 0.0 1.1 0:00.18 httpd
12373 apache 15 0 28404 10m 3100 S 0.0 1.0 0:00.12 httpd
12364 apache 15 0 28324 10m 3116 S 0.0 1.0 0:00.09 httpd
12360 apache 15 0 26600 8936 3020 S 0.0 0.9 0:00.06 httpd
12361 apache 15 0 25684 6996 2108 S 0.0 0.7 0:00.01 httpd
1952 root 12 -3 9496 3796 2204 S 0.0 0.4 0:00.76 python
2766 haldaemo 18 0 5616 3736 1620 S 0.0 0.4 0:01.03 hald
24687 root 15 0 8156 2348 1880 R 0.0 0.2 0:00.02 sshd
2316 root 15 0 9580 2000 1392 S 0.0 0.2 0:00.00 cupsd
2495 root 15 0 8560 1820 764 S 0.0 0.2 0:00.00 sendmail
[/code]


could this be the cause of the slow response times I'm getting fromt he website? I have read a few articles on "tweaking" apache memory usage, but as the site will be running a web game, using ajax to make virtually constant calls to PHP/MySQL I daren't start applying these incase it impacts the performence of the game (although as it stands, I doubt the game will be performing well anyway so nothing to lose I guess)

Any help and/or advice would be greatly appreciated.

shavenlunatic
Posts: 7
Joined: 2008/05/12 10:17:22

Re: httpd memory usage high

Post by shavenlunatic » 2008/05/12 12:23:08

inciidentally, after a reboot it shows as:

[code]
top - 14:21:50 up 2 min, 1 user, load average: 1.15, 1.13, 0.47
Tasks: 80 total, 3 running, 77 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.3%us, 0.3%sy, 0.0%ni, 99.0%id, 0.0%wa, 0.3%hi, 0.0%si, 0.0%st
Mem: 1035208k total, 234928k used, 800280k free, 15548k buffers
Swap: 2031608k total, 0k used, 2031608k free, 160700k cached

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
2456 mysql 20 0 133m 17m 3352 S 0.0 1.8 0:00.05 mysqld
2732 root 15 0 23800 10m 2720 R 0.0 1.0 0:00.06 yum-updatesd
2537 root 18 0 24632 9760 5736 S 0.0 0.9 0:00.15 httpd
2580 apache 18 0 24764 4924 876 S 0.0 0.5 0:00.00 httpd
2581 apache 18 0 24764 4924 876 S 0.0 0.5 0:00.00 httpd
2582 apache 18 0 24764 4924 876 S 0.0 0.5 0:00.00 httpd
2583 apache 18 0 24764 4924 876 S 0.0 0.5 0:00.00 httpd
2584 apache 18 0 24764 4924 876 S 0.0 0.5 0:00.00 httpd
2585 apache 23 0 24764 4924 876 S 0.0 0.5 0:00.00 httpd
2586 apache 23 0 24764 4924 876 S 0.0 0.5 0:00.00 httpd
2587 apache 23 0 24764 4924 876 S 0.0 0.5 0:00.00 httpd
[/code]

but it creeps up :(



also, httpd error log:

[code]
[Mon May 12 14:18:09 2008] [notice] caught SIGTERM, shutting down
[Mon May 12 14:20:28 2008] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Mon May 12 14:20:28 2008] [notice] Digest: generating secret for digest authentication ...
[Mon May 12 14:20:28 2008] [notice] Digest: done
[Mon May 12 14:20:29 2008] [notice] mod_python: Creating 4 session mutexes based on 256 max processes and 0 max threads.
[Mon May 12 14:20:29 2008] [notice] Apache/2.2.3 (CentOS) configured -- resuming normal operations
[Mon May 12 14:22:54 2008] [error] [client 213.106.226.245] Directory index forbidden by Options directive: /var/www/html/
[Mon May 12 14:22:54 2008] [error] [client 213.106.226.245] File does not exist: /var/www/html/favicon.ico
[/code]

and a few other File does not exists

shavenlunatic
Posts: 7
Joined: 2008/05/12 10:17:22

Re: httpd memory usage high

Post by shavenlunatic » 2008/05/12 21:52:30

hmm, went into "setup" and disabled firewall.. it seems that was causing the lag.

At the minute the server isn't "live" but it will be soon and I expect a firewall would be sensible... so can:

a) anyone tell me what I need to do to stop the firewall slowing the server speed down to a snails pace?

b) someone point me to a good (and easy to setup) firewall which won't cause slowdown problems



that's if anyone replies to this..lol :)

User avatar
WhatsHisName
Posts: 1547
Joined: 2005/12/19 20:21:43
Location: /earth/usa/nj

httpd memory usage high

Post by WhatsHisName » 2008/05/12 22:55:42

The problems you have described are not typical, at least on non-vps systems, and there is not a lot to go on in your description.

You may be suffering from some idiosyncrasy of your provider's setup that we will unlikely be able to identify.

Descriptions of "slow" in linux are often associated with name resolution problems.

Look at the [url=http://httpd.apache.org/]Apache Documentation[/url] page [url=http://httpd.apache.org/docs/2.2/dns-caveats.html]Issues Regarding DNS and Apache[/url] and see if anything strikes you.

Beyond that, the apache site is your friend and the search function is an excellent place to start.

public_domain
Posts: 28
Joined: 2007/11/18 06:05:23
Contact:

Re: httpd memory usage high

Post by public_domain » 2008/05/18 05:55:47

"i have a webserver with centos 5..." and "(we are currently on a shared web server, in the processing of moving to increase speed and the new dedicated server is slower.. much much slower)"

which is it? is the system yours or someone else's?

Wream
Posts: 31
Joined: 2008/06/01 21:49:02
Contact:

Re: httpd memory usage high

Post by Wream » 2008/06/14 03:47:24

Now this may not directly relate to your issue with Apache, but have you considered using lighttpd or nginx to run your web server instead? might be a viable option to think about as you'll almost assuredly get better performance out of them. :-)

Post Reply

Return to “CentOS 5 - Webhosting Support”