You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Terence Le Grange <te...@sunway.edu.my> on 2008/04/21 09:51:30 UTC

[users@httpd] Apache Not Releasing Memory 2.2.0 using Moodle

Dear All,

I have installed Moodle version 1.8 and am facing problems whereby the
server resources are bring consumed within seconds. Each page request
through http is consuming between 20 and 35 MB RAM. The server works well
for loads of approximately 20 users but at 25 or 30 it just crashes and I
need to restart the httpd process. Current setup is Fedora Core 5 (Apache
2.2.0) with 512 MB of memory.

Looking at TOP, I see that apache is not recycling it's memory (each process
takes up between 1 and 6% and even though it's been idle for some time it
does not seem to recycle it. Memory then stays at about 500MB until such
time as I restart the service and it drops to 230MB (I currently restart the
service hourly which very often fails). A snapshot of my process list is as
follows:

top - 15:46:56 up  4:15,  2 users,  load average: 0.00, 0.03, 0.02
Tasks:  91 total,   1 running,  90 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.2% us,  0.0% sy,  0.0% ni, 99.8% id,  0.0% wa,  0.0% hi,  0.0% si
Mem:    504156k total,   474812k used,    29344k free,    28988k buffers
Swap:  1534196k total,        0k used,  1534196k free,    92952k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND

 4991 apache    16   0 43292  20m 4436 S    0  4.1   0:01.37 httpd

 4992 apache    15   0 52168  29m 4520 S    0  5.9   0:02.11 httpd

 4993 apache    15   0 43148  20m 4320 S    0  4.1   0:01.25 httpd

 4994 apache    15   0 43140  20m 4396 S    0  4.1   0:01.82 httpd

 4995 apache    16   0 43484  21m 5388 S    0  4.3   0:01.66 httpd

 4996 apache    17   0 48540  26m 5428 S    0  5.4   0:02.57 httpd

 4997 apache    15   0 47844  24m 4376 S    0  5.0   0:02.31 httpd

 4998 apache    15   0 43260  20m 4360 S    0  4.1   0:01.70 httpd

 4999 apache    15   0 60444  37m 4496 S    0  7.5   0:02.38 httpd

 5000 apache    15   0 60624  37m 4560 S    0  7.6   0:09.21 httpd

 5001 apache    16   0 50868  27m 4412 S    0  5.6   0:06.82 httpd

 5002 apache    15   0 43148  20m 4380 S    0  4.1   0:01.89 httpd

 5003 apache    16   0 50868  27m 4412 S    0  5.6   0:01.58 httpd

 5004 apache    15   0 43284  20m 4368 S    0  4.1   0:00.55 httpd

 5005 apache    16   0 50980  27m 4412 S    0  5.6   0:02.21 httpd

 5112 apache    15   0 43248  19m 4148 S    0  4.0   0:00.47 httpd        


I have been tweaking around with the conf file and this is what I currently
have:

KeepAlive On

#
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 100

#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 5

##
## Server-Pool Size Regulation (MPM specific)
##

# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# ServerLimit: maximum value for MaxClients for the lifetime of the server
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule prefork.c>
StartServers       15
MinSpareServers    10
MaxSpareServers   20
ServerLimit      512
MaxClients       512
MaxRequestsPerChild  4000
</IfModule>

# worker MPM
# StartServers: initial number of server processes to start
# MaxClients: maximum number of simultaneous client connections
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule worker.c>
StartServers        10
MaxClients         256
MinSpareThreads     25
MaxSpareThreads     75
ThreadsPerChild     75
MaxRequestsPerChild  4000
</IfModule>


I have read the Moodle docs on Apache performance, googled and read the
Apache website for the past week without siginificant improvements when
changing these variables. I also am aware of the significant resources that
Moodle consumes, but would hope that it could at least support 30 users.

I have tried doubling max open files to 100k. (/proc/sys/fs/file-max)


If someone could assist in pointing me in any direction I would greatly
appreciate it.


Kind Regards,

Terence


---------------------------------------------------------------------
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] Apache Not Releasing Memory 2.2.0 using Moodle

Posted by Terence Le Grange <te...@sunway.edu.my>.
Hi,

Here is the output from "free -m"

             total       used       free     shared    buffers     cached
Mem:           492        485          6          0         97        156
-/+ buffers/cache:        232        259
Swap:         1498         19       1479


What happens is that the process dies, even after issueing a
/etc/rc.d/init.d/https restart - it says [ok] but the process does not start
and I need to reboot. Then it's fine.

Thanks for your help!

Kind Regards,

Terence Le Grange



-----Original Message-----
From: Arnab Ganguly [mailto:aganguly01@gmail.com] 
Sent: Monday, April 21, 2008 8:24 PM
To: users@httpd.apache.org
Subject: Re: [users@httpd] Apache Not Releasing Memory 2.2.0 using Moodle

Hi All,
Can you tell me what is the output you get when you run the free -m
command.Also when the process is idle it won't release the memory back.I
guess it will be put in the Swap space of OS.top -p pid won't be coming
down.

Also I see from the configuration file both perfork and worker is being used
is it so?I am not clear about the configuration.Are you getting any crash on
the Apache?
Thanks
-A


On Mon, Apr 21, 2008 at 1:21 PM, Terence Le Grange <te...@sunway.edu.my>
wrote:


	Dear All,
	
	I have installed Moodle version 1.8 and am facing problems whereby
the
	server resources are bring consumed within seconds. Each page
request
	through http is consuming between 20 and 35 MB RAM. The server works
well
	for loads of approximately 20 users but at 25 or 30 it just crashes
and I
	need to restart the httpd process. Current setup is Fedora Core 5
(Apache
	2.2.0) with 512 MB of memory.
	
	Looking at TOP, I see that apache is not recycling it's memory (each
process
	takes up between 1 and 6% and even though it's been idle for some
time it
	does not seem to recycle it. Memory then stays at about 500MB until
such
	time as I restart the service and it drops to 230MB (I currently
restart the
	service hourly which very often fails). A snapshot of my process
list is as
	follows:
	
	top - 15:46:56 up  4:15,  2 users,  load average: 0.00, 0.03, 0.02
	Tasks:  91 total,   1 running,  90 sleeping,   0 stopped,   0 zombie
	Cpu(s):  0.2% us,  0.0% sy,  0.0% ni, 99.8% id,  0.0% wa,  0.0% hi,
0.0% si
	Mem:    504156k total,   474812k used,    29344k free,    28988k
buffers
	Swap:  1534196k total,        0k used,  1534196k free,    92952k
cached
	
	 PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
	
	 4991 apache    16   0 43292  20m 4436 S    0  4.1   0:01.37 httpd
	
	 4992 apache    15   0 52168  29m 4520 S    0  5.9   0:02.11 httpd
	
	 4993 apache    15   0 43148  20m 4320 S    0  4.1   0:01.25 httpd
	
	 4994 apache    15   0 43140  20m 4396 S    0  4.1   0:01.82 httpd
	
	 4995 apache    16   0 43484  21m 5388 S    0  4.3   0:01.66 httpd
	
	 4996 apache    17   0 48540  26m 5428 S    0  5.4   0:02.57 httpd
	
	 4997 apache    15   0 47844  24m 4376 S    0  5.0   0:02.31 httpd
	
	 4998 apache    15   0 43260  20m 4360 S    0  4.1   0:01.70 httpd
	
	 4999 apache    15   0 60444  37m 4496 S    0  7.5   0:02.38 httpd
	
	 5000 apache    15   0 60624  37m 4560 S    0  7.6   0:09.21 httpd
	
	 5001 apache    16   0 50868  27m 4412 S    0  5.6   0:06.82 httpd
	
	 5002 apache    15   0 43148  20m 4380 S    0  4.1   0:01.89 httpd
	
	 5003 apache    16   0 50868  27m 4412 S    0  5.6   0:01.58 httpd
	
	 5004 apache    15   0 43284  20m 4368 S    0  4.1   0:00.55 httpd
	
	 5005 apache    16   0 50980  27m 4412 S    0  5.6   0:02.21 httpd
	
	 5112 apache    15   0 43248  19m 4148 S    0  4.0   0:00.47 httpd
	
	
	I have been tweaking around with the conf file and this is what I
currently
	have:
	
	KeepAlive On
	
	#
	# MaxKeepAliveRequests: The maximum number of requests to allow
	# during a persistent connection. Set to 0 to allow an unlimited
amount.
	# We recommend you leave this number high, for maximum performance.
	#
	MaxKeepAliveRequests 100
	
	#
	# KeepAliveTimeout: Number of seconds to wait for the next request
from the
	# same client on the same connection.
	#
	KeepAliveTimeout 5
	
	##
	## Server-Pool Size Regulation (MPM specific)
	##
	
	# prefork MPM
	# StartServers: number of server processes to start
	# MinSpareServers: minimum number of server processes which are kept
spare
	# MaxSpareServers: maximum number of server processes which are kept
spare
	# ServerLimit: maximum value for MaxClients for the lifetime of the
server
	# MaxClients: maximum number of server processes allowed to start
	# MaxRequestsPerChild: maximum number of requests a server process
serves
	<IfModule prefork.c>
	StartServers       15
	MinSpareServers    10
	MaxSpareServers   20
	ServerLimit      512
	MaxClients       512
	MaxRequestsPerChild  4000
	</IfModule>
	
	# worker MPM
	# StartServers: initial number of server processes to start
	# MaxClients: maximum number of simultaneous client connections
	# MinSpareThreads: minimum number of worker threads which are kept
spare
	# MaxSpareThreads: maximum number of worker threads which are kept
spare
	# ThreadsPerChild: constant number of worker threads in each server
process
	# MaxRequestsPerChild: maximum number of requests a server process
serves
	<IfModule worker.c>
	StartServers        10
	MaxClients         256
	MinSpareThreads     25
	MaxSpareThreads     75
	ThreadsPerChild     75
	MaxRequestsPerChild  4000
	</IfModule>
	
	
	I have read the Moodle docs on Apache performance, googled and read
the
	Apache website for the past week without siginificant improvements
when
	changing these variables. I also am aware of the significant
resources that
	Moodle consumes, but would hope that it could at least support 30
users.
	
	I have tried doubling max open files to 100k.
(/proc/sys/fs/file-max)
	
	
	If someone could assist in pointing me in any direction I would
greatly
	appreciate it.
	
	
	Kind Regards,
	
	Terence
	
	
	
---------------------------------------------------------------------
	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
	
	




---------------------------------------------------------------------
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] Apache Not Releasing Memory 2.2.0 using Moodle

Posted by Arnab Ganguly <ag...@gmail.com>.
Hi All,
Can you tell me what is the output you get when you run the free -m
command.Also when the process is idle it won't release the memory back.I
guess it will be put in the Swap space of OS.top -p pid won't be coming
down.

Also I see from the configuration file both perfork and worker is being used
is it so?I am not clear about the configuration.Are you getting any crash on
the Apache?
Thanks
-A

On Mon, Apr 21, 2008 at 1:21 PM, Terence Le Grange <te...@sunway.edu.my>
wrote:

> Dear All,
>
> I have installed Moodle version 1.8 and am facing problems whereby the
> server resources are bring consumed within seconds. Each page request
> through http is consuming between 20 and 35 MB RAM. The server works well
> for loads of approximately 20 users but at 25 or 30 it just crashes and I
> need to restart the httpd process. Current setup is Fedora Core 5 (Apache
> 2.2.0) with 512 MB of memory.
>
> Looking at TOP, I see that apache is not recycling it's memory (each
> process
> takes up between 1 and 6% and even though it's been idle for some time it
> does not seem to recycle it. Memory then stays at about 500MB until such
> time as I restart the service and it drops to 230MB (I currently restart
> the
> service hourly which very often fails). A snapshot of my process list is
> as
> follows:
>
> top - 15:46:56 up  4:15,  2 users,  load average: 0.00, 0.03, 0.02
> Tasks:  91 total,   1 running,  90 sleeping,   0 stopped,   0 zombie
> Cpu(s):  0.2% us,  0.0% sy,  0.0% ni, 99.8% id,  0.0% wa,  0.0% hi,  0.0%
> si
> Mem:    504156k total,   474812k used,    29344k free,    28988k buffers
> Swap:  1534196k total,        0k used,  1534196k free,    92952k cached
>
>  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
>
>  4991 apache    16   0 43292  20m 4436 S    0  4.1   0:01.37 httpd
>
>  4992 apache    15   0 52168  29m 4520 S    0  5.9   0:02.11 httpd
>
>  4993 apache    15   0 43148  20m 4320 S    0  4.1   0:01.25 httpd
>
>  4994 apache    15   0 43140  20m 4396 S    0  4.1   0:01.82 httpd
>
>  4995 apache    16   0 43484  21m 5388 S    0  4.3   0:01.66 httpd
>
>  4996 apache    17   0 48540  26m 5428 S    0  5.4   0:02.57 httpd
>
>  4997 apache    15   0 47844  24m 4376 S    0  5.0   0:02.31 httpd
>
>  4998 apache    15   0 43260  20m 4360 S    0  4.1   0:01.70 httpd
>
>  4999 apache    15   0 60444  37m 4496 S    0  7.5   0:02.38 httpd
>
>  5000 apache    15   0 60624  37m 4560 S    0  7.6   0:09.21 httpd
>
>  5001 apache    16   0 50868  27m 4412 S    0  5.6   0:06.82 httpd
>
>  5002 apache    15   0 43148  20m 4380 S    0  4.1   0:01.89 httpd
>
>  5003 apache    16   0 50868  27m 4412 S    0  5.6   0:01.58 httpd
>
>  5004 apache    15   0 43284  20m 4368 S    0  4.1   0:00.55 httpd
>
>  5005 apache    16   0 50980  27m 4412 S    0  5.6   0:02.21 httpd
>
>  5112 apache    15   0 43248  19m 4148 S    0  4.0   0:00.47 httpd
>
>
> I have been tweaking around with the conf file and this is what I
> currently
> have:
>
> KeepAlive On
>
> #
> # MaxKeepAliveRequests: The maximum number of requests to allow
> # during a persistent connection. Set to 0 to allow an unlimited amount.
> # We recommend you leave this number high, for maximum performance.
> #
> MaxKeepAliveRequests 100
>
> #
> # KeepAliveTimeout: Number of seconds to wait for the next request from
> the
> # same client on the same connection.
> #
> KeepAliveTimeout 5
>
> ##
> ## Server-Pool Size Regulation (MPM specific)
> ##
>
> # prefork MPM
> # StartServers: number of server processes to start
> # MinSpareServers: minimum number of server processes which are kept spare
> # MaxSpareServers: maximum number of server processes which are kept spare
> # ServerLimit: maximum value for MaxClients for the lifetime of the server
> # MaxClients: maximum number of server processes allowed to start
> # MaxRequestsPerChild: maximum number of requests a server process serves
> <IfModule prefork.c>
> StartServers       15
> MinSpareServers    10
> MaxSpareServers   20
> ServerLimit      512
> MaxClients       512
> MaxRequestsPerChild  4000
> </IfModule>
>
> # worker MPM
> # StartServers: initial number of server processes to start
> # MaxClients: maximum number of simultaneous client connections
> # MinSpareThreads: minimum number of worker threads which are kept spare
> # MaxSpareThreads: maximum number of worker threads which are kept spare
> # ThreadsPerChild: constant number of worker threads in each server
> process
> # MaxRequestsPerChild: maximum number of requests a server process serves
> <IfModule worker.c>
> StartServers        10
> MaxClients         256
> MinSpareThreads     25
> MaxSpareThreads     75
> ThreadsPerChild     75
> MaxRequestsPerChild  4000
> </IfModule>
>
>
> I have read the Moodle docs on Apache performance, googled and read the
> Apache website for the past week without siginificant improvements when
> changing these variables. I also am aware of the significant resources
> that
> Moodle consumes, but would hope that it could at least support 30 users.
>
> I have tried doubling max open files to 100k. (/proc/sys/fs/file-max)
>
>
> If someone could assist in pointing me in any direction I would greatly
> appreciate it.
>
>
> Kind Regards,
>
> Terence
>
>
> ---------------------------------------------------------------------
> 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
>
>