[Mono-list] Memory usage of mod_mono
Mark Prins (DSL AK)
markprins@datacom.co.nz
Thu, 17 Feb 2005 08:55:28 +1300
This is a multi-part message in MIME format.
------_=_NextPart_001_01C51461.7694363A
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
> Hi,=20
>=20
> We've written a content management web application using mono,
> mod_mono & apache running on a slackware 10 (client's choice, not
> ours) server. We've got two problems. The first is an intermittent
> hang - whereby the mono processes are still running but no longer
> serve requests. Killing all mono processes or restarting apache gets
> the site responding again. We're still working on that one and have a
> workaround in place, of more concern is the other problem: the site
> just gobbles up memory until it uses all available and then,
> particularly on the production box, the whole server falls over. We've
> had to take the site off the production server now and are running a
> static version of the site.
>=20
> My question is: is anyone running a busy site using mod_mono on
> apache? Have they noticed memory usage issues? We're working with an
> average of 50,000 hits a day on the production server, so it doesn't
> take long for the server to fall over.
>=20
> I've tried a few different configurations, to try and narrow it down,
> but all of these have problems:
>=20
> - Run the site on Red Hat Enterprise WS, with mono installed from
> RPMs, apache ( 2.0.50 ) from source
> - the site runs fine on windows, but that's not really relevant so I
> won't mention it..
> - Slackware 10 / mono 1.0.5 / mod_mono 1.0.5 / apache 2.0.52 (all
> installed from source)
> - Slackware 10 / mono 1.0.5 / mod_mono 1.0.5 / apache 2.0.50 (all
> installed from source, three different machines)
> - Slackware 10 / mono 1.1.3 / mod_mono 1.0.5 / apache 2.0.50 (all
> installed from source)
> - on Slackware 10 / mono 1.0.5 / mod_mono 1.0.5 / apache 2.0.50:
> -- using an aspx page with only response.write in it
> -- using an aspx page with no server-side code at all
> -- adding GC.Collect() at various points in the code
>=20
> We've been building the app while several versions of mono have been
> released - we started on 1.0.1, so I've also tested on:
> - Slackware 10 / mono 1.0.2 / mod_mono 1.0.5 / apache 2.0.50 (from
> source)
> - Slackware 10 / mono 1.0.2 / mod_mono 1.0.2 / apache 2.0.50 (from
> source)
>=20
> As well as the Red Hat distribution we've had a look at both debian
> and Suse and have noticed memory leaking on them too. My concern isn't
> so much that memory usage increases, it's that there is no limit to it
> and that the mono processes don't restart when they've consumed a huge
> amount of resource.
> Basic configuration is something like this:
>=20
> Apache install: ./configure --prefix=3D/usr/local/apache2
> --enable-rewrite --enable-headers --enable-expires
> Mono: ./configure --with-apxs=3D/usr/local/apache2/bin/apxs
> Mod_mono: ./configure
> *** Httpd.conf changes: ***
> LoadModule mono_module modules/mod_mono.so
> MonoRunXSP True
> MonoUnixSocket /tmp/mod_mono_server
> AddType application/x-asp-net .aspx .ashx .asmx .ascx .asax .config
> .ascx
> MonoApplications "/:/web/http"
>=20
> <Directory "/web/http">
> AddHandler mono .aspx .ascx .asax .ashx .config .cs .asmx .htm
> <FilesMatch "\.(aspx|ascx|ashx|config|cs|asmx|htm)$">=20
> SetHandler mono
> </FilesMatch>
> # This rather convoluted bit is because RequestHeader & Header
> won't return normal env vars=20
> # and also won't just echo env vars
> RewriteEngine ON
> RewriteCond %{REQUEST_FILENAME} !-f
> RewriteCond %{REQUEST_FILENAME} !-d
> RewriteRule ^(.*) /404b.aspx [E=3DURI:%{REQUEST_URI}]
> RequestHeader set URI %{REDIRECT_URI}e
> Options FollowSymLinks ExecCGI=20
> AllowOverride None
> Order allow,deny
> Allow from all
> </Directory>
> *** End httpd.conf changes ***
>=20
> If I set a load generator on a simple aspx page served by a server
> configured like this, the memory usage simply increases until
> eventually the server gives up.
> I've also tried using MonoMaxMemory and MonoMaxCPUTime but for me max
> CPU time has no effect and max memory stops ASP.NET pages responding
> once the limit is reached. I'd expected the mono processes to recycle,
> avoiding any memory issues but whatever I do, the processes don't seem
> to restart. Should they? I did see it happen once on one of the
> earlier configurations when the GC was turned off ( I was testing
> something.. ) but am unable to replicate now.
>=20
> Any advice appreciated. Even with these problems at the end of a long
> project, I'm still keen to use mono for this and future projects -
> it's a fine piece of work.
> Thanks
> Mark Prins
>=20
>=20
------_=_NextPart_001_01C51461.7694363A
Content-Type: text/html;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
6.5.7226.0">
<TITLE>Memory usage of mod_mono</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->
<P><FONT SIZE=3D2 FACE=3D"Trebuchet MS">Hi, </FONT>
</P>
<P><FONT SIZE=3D2 FACE=3D"Trebuchet MS">We've written a content =
management web application using mono, mod_mono & apache running on =
a slackware 10 (client's choice, not ours) server. We've got two =
problems. The first is an intermittent hang - whereby the mono processes =
are still running but no longer serve requests. Killing all mono =
processes or restarting apache gets the site responding again. We're =
still working on that one and have a workaround in place, of more =
concern is the other problem: the site just gobbles up memory until it =
uses all available and then, particularly on the production box, the =
whole server falls over. We've had to take the site off the production =
server now and are running a static version of the site.</FONT></P>
<P><FONT SIZE=3D2 FACE=3D"Trebuchet MS">My question is: is anyone =
running a busy site using mod_mono on apache? Have they noticed memory =
usage issues? We're working with an average of 50,000 hits a day on the =
production server, so it doesn't take long for the server to fall =
over.</FONT></P>
<P><FONT SIZE=3D2 FACE=3D"Trebuchet MS">I've tried a few different =
configurations, to try and narrow it down, but all of these have =
problems:</FONT>
</P>
<P><FONT SIZE=3D2 FACE=3D"Trebuchet MS">- Run the site on Red Hat =
Enterprise WS, with mono installed from RPMs, apache (<SPAN =
LANG=3D"en-nz"> 2.0.50 ) from source</SPAN></FONT>
<BR><SPAN LANG=3D"en-nz"><FONT SIZE=3D2 FACE=3D"Trebuchet MS">- the site =
runs fine on windows, but that's not really relevant so I won't mention =
it..</FONT></SPAN>
<BR><SPAN LANG=3D"en-nz"><FONT SIZE=3D2 FACE=3D"Trebuchet =
MS">-</FONT></SPAN><SPAN LANG=3D"en-us"> <FONT SIZE=3D2 =
FACE=3D"Trebuchet MS">Slackware 10 / mono 1.0.5 / mod_mono 1.0.5 / =
apache 2.0.52 (all installed from source)</FONT></SPAN>
<BR><SPAN LANG=3D"en-nz"><FONT SIZE=3D2 FACE=3D"Trebuchet =
MS">-</FONT></SPAN><SPAN LANG=3D"en-us"> <FONT SIZE=3D2 =
FACE=3D"Trebuchet MS">Slackware 10 / mono 1.0.5 / mod_mono 1.0.5 / =
apache 2.0.50 (all installed from source, three different =
machines)</FONT></SPAN>
<BR><SPAN LANG=3D"en-nz"><FONT SIZE=3D2 FACE=3D"Trebuchet =
MS">-</FONT></SPAN><SPAN LANG=3D"en-us"> <FONT SIZE=3D2 =
FACE=3D"Trebuchet MS">Slackware 10 / mono 1.1.3 / mod_mono 1.0.5 / =
apache 2.0.50 (all installed from source)</FONT></SPAN>
<BR><SPAN LANG=3D"en-us"><FONT SIZE=3D2 FACE=3D"Trebuchet MS">- on =
Slackware 10 / mono 1.0.5 / mod_mono 1.0.5 / apache =
2.0.50:</FONT></SPAN>
<BR><SPAN LANG=3D"en-us"><FONT SIZE=3D2 FACE=3D"Trebuchet MS">-- using =
an aspx page with only response.write in it</FONT></SPAN>
<BR><SPAN LANG=3D"en-us"><FONT SIZE=3D2 FACE=3D"Trebuchet MS">-- using =
an aspx page with no server-side code at all</FONT></SPAN>
<BR><SPAN LANG=3D"en-us"><FONT SIZE=3D2 FACE=3D"Trebuchet MS">-- adding =
GC.Collect() at various points in the code</FONT></SPAN>
</P>
<P><SPAN LANG=3D"en-us"><FONT SIZE=3D2 FACE=3D"Trebuchet MS">We've been =
building the app while several versions of mono have been released - we =
started on 1.0.1, so I've also tested on:</FONT></SPAN></P>
<P><SPAN LANG=3D"en-nz"><FONT SIZE=3D2 FACE=3D"Trebuchet =
MS">-</FONT></SPAN><SPAN LANG=3D"en-us"> <FONT SIZE=3D2 =
FACE=3D"Trebuchet MS">Slackware 10 / mono 1.0.2 / mod_mono 1.0.5 / =
apache 2.0.50 (from source)</FONT></SPAN>
<BR><SPAN LANG=3D"en-nz"><FONT SIZE=3D2 FACE=3D"Trebuchet =
MS">-</FONT></SPAN><SPAN LANG=3D"en-us"> <FONT SIZE=3D2 =
FACE=3D"Trebuchet MS">Slackware 10 / mono 1.0.2 / mod_mono 1.0.2 / =
apache 2.0.50 (from source)</FONT></SPAN>
</P>
<P><SPAN LANG=3D"en-us"><FONT SIZE=3D2 FACE=3D"Trebuchet MS">As well as =
the Red Hat distribution we've had a look at both debian and Suse and =
have noticed memory leaking on them too. My concern isn't so much that =
memory usage increases, it's that there is no limit to it and that the =
mono processes don't restart when they've consumed a huge amount of =
resource.<BR>
Basic configuration is something like this:</FONT></SPAN>
</P>
<P><SPAN LANG=3D"en-us"><FONT SIZE=3D2 FACE=3D"Trebuchet MS">Apache =
install: ./configure --prefix=3D/usr/local/apache2 --enable-rewrite =
--enable-headers --enable-expires</FONT></SPAN>
<BR><SPAN LANG=3D"en-us"><FONT SIZE=3D2 FACE=3D"Trebuchet MS">Mono: =
./configure --with-apxs=3D/usr/local/apache2/bin/apxs</FONT></SPAN>
<BR><SPAN LANG=3D"en-us"><FONT SIZE=3D2 FACE=3D"Trebuchet MS">Mod_mono: =
./configure</FONT></SPAN>
<BR><SPAN LANG=3D"en-us"><FONT SIZE=3D2 FACE=3D"Trebuchet MS">*** =
Httpd.conf changes: ***</FONT></SPAN>
<BR><SPAN LANG=3D"en-us"><FONT SIZE=3D2 FACE=3D"Trebuchet MS">LoadModule =
mono_module =
modules/mod_mono.so</FONT></SPAN>
<BR><SPAN LANG=3D"en-us"><FONT SIZE=3D2 FACE=3D"Trebuchet MS">MonoRunXSP =
True</FONT></SPAN>
<BR><SPAN LANG=3D"en-us"><FONT SIZE=3D2 FACE=3D"Trebuchet =
MS">MonoUnixSocket /tmp/mod_mono_server</FONT></SPAN>
<BR><SPAN LANG=3D"en-us"><FONT SIZE=3D2 FACE=3D"Trebuchet MS">AddType =
application/x-asp-net .aspx .ashx .asmx .ascx .asax .config =
.ascx</FONT></SPAN>
<BR><SPAN LANG=3D"en-us"><FONT SIZE=3D2 FACE=3D"Trebuchet =
MS">MonoApplications "/:/web/http"</FONT></SPAN>
</P>
<P><SPAN LANG=3D"en-us"><FONT SIZE=3D2 FACE=3D"Trebuchet =
MS"><Directory "/web/http"></FONT></SPAN>
<BR><SPAN LANG=3D"en-us"> =
<FONT SIZE=3D2 FACE=3D"Trebuchet MS">AddHandler mono .aspx .ascx .asax =
.ashx .config .cs .asmx .htm</FONT></SPAN>
<BR><SPAN LANG=3D"en-us"> =
<FONT SIZE=3D2 FACE=3D"Trebuchet MS"><FilesMatch =
"\.(aspx|ascx|ashx|config|cs|asmx|htm)$"> </FONT></SPAN>
<BR><SPAN LANG=3D"en-us"> =
<FONT SIZE=3D2 =
FACE=3D"Trebuchet MS">SetHandler mono</FONT></SPAN>
<BR><SPAN LANG=3D"en-us"> =
<FONT SIZE=3D2 FACE=3D"Trebuchet MS"></FilesMatch></FONT></SPAN>
<BR><SPAN LANG=3D"en-us"> =
<FONT SIZE=3D2 FACE=3D"Trebuchet MS"># This rather convoluted bit is =
because RequestHeader & Header won't return normal env vars =
</FONT></SPAN>
<BR><SPAN LANG=3D"en-us"> =
<FONT SIZE=3D2 FACE=3D"Trebuchet MS"># and also won't just echo env =
vars</FONT></SPAN>
<BR><SPAN LANG=3D"en-us"> =
<FONT SIZE=3D2 FACE=3D"Trebuchet MS">RewriteEngine ON</FONT></SPAN>
<BR><SPAN LANG=3D"en-us"> =
<FONT SIZE=3D2 FACE=3D"Trebuchet MS">RewriteCond %{REQUEST_FILENAME} =
!-f</FONT></SPAN>
<BR><SPAN LANG=3D"en-us"> =
<FONT SIZE=3D2 FACE=3D"Trebuchet MS">RewriteCond %{REQUEST_FILENAME} =
!-d</FONT></SPAN>
<BR><SPAN LANG=3D"en-us"> =
<FONT SIZE=3D2 FACE=3D"Trebuchet MS">RewriteRule ^(.*) /404b.aspx =
[E=3DURI:%{REQUEST_URI}]</FONT></SPAN>
<BR><SPAN LANG=3D"en-us"> =
<FONT SIZE=3D2 FACE=3D"Trebuchet MS">RequestHeader set URI =
%{REDIRECT_URI}e</FONT></SPAN>
<BR><SPAN LANG=3D"en-us"> =
<FONT SIZE=3D2 FACE=3D"Trebuchet MS">Options FollowSymLinks ExecCGI =
</FONT></SPAN>
<BR><SPAN LANG=3D"en-us"> =
<FONT SIZE=3D2 FACE=3D"Trebuchet MS">AllowOverride None</FONT></SPAN>
<BR><SPAN LANG=3D"en-us"> =
<FONT SIZE=3D2 FACE=3D"Trebuchet MS">Order allow,deny</FONT></SPAN>
<BR><SPAN LANG=3D"en-us"> =
<FONT SIZE=3D2 FACE=3D"Trebuchet MS">Allow from all</FONT></SPAN>
<BR><SPAN LANG=3D"en-us"><FONT SIZE=3D2 FACE=3D"Trebuchet =
MS"></Directory></FONT></SPAN>
<BR><SPAN LANG=3D"en-us"><FONT SIZE=3D2 FACE=3D"Trebuchet MS">*** End =
httpd.conf changes ***</FONT></SPAN>
</P>
<P><SPAN LANG=3D"en-us"><FONT SIZE=3D2 FACE=3D"Trebuchet MS">If I set a =
load generator on a simple aspx page served by a server configured like =
this, the memory usage simply increases until eventually the server =
gives up.</FONT></SPAN></P>
<P><SPAN LANG=3D"en-us"><FONT SIZE=3D2 FACE=3D"Trebuchet MS">I've also =
tried using MonoMaxMemory and MonoMaxCPUTime but for me max CPU time has =
no effect and max memory stops ASP.NET pages responding once the limit =
is reached. I'd expected the mono processes to recycle, avoiding any =
memory issues but whatever I do, the processes don’t seem to =
restart. Should they? I did see it happen once on one of the earlier =
configurations when the GC was turned off ( I was testing something.. ) =
but am unable to replicate now.</FONT></SPAN></P>
<P><SPAN LANG=3D"en-us"><FONT SIZE=3D2 FACE=3D"Trebuchet MS">Any advice =
appreciated. Even with these problems at the end of a long project, I'm =
still keen to use mono for this and future projects - it's a fine piece =
of work.</FONT></SPAN></P>
<P><SPAN LANG=3D"en-us"><FONT SIZE=3D2 FACE=3D"Trebuchet =
MS">Thanks</FONT></SPAN>
<BR><SPAN LANG=3D"en-us"><FONT SIZE=3D2 FACE=3D"Trebuchet MS">Mark =
Prins</FONT></SPAN>
</P>
<BR>
</BODY>
</HTML>
------_=_NextPart_001_01C51461.7694363A--