Apache::SizeLimit?

[prev] [thread] [next] [Date index for 2005/05/11]

From: Torsten Foertsch
Subject: Apache::SizeLimit?
Date: 11:27 on 11 May 2005
--nextPart7348950.5A7Rt56HSW
Content-Type: text/plain;
  charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Hi,

as I have learned from the "Debugging memory allocation" thread=20
Apache::SizeLimit can be used to kill a child if it's unshared part grows t=
o=20
big. To measure this unshared part on linux /proc/PID/statm is used. I was =
in=20
doubt that the simple difference between the total number of pages and the=
=20
shared pages really reflect the unshared part. So, I tried out some things:

=46irst, in httpd.conf I allocate a noticeable amount of memory:

<Perl>
$My::Klaus=3D"x"x10000000;
</Perl>

This memory is shared among all children due to linux' copy on write.

Now /proc/PID/statm for the master and a child say:

master: 5254 4190 2089 71 0 3094 0
child:  5272 4208 2107 71 0 3094 0

When I write to $My::Klaus from within a child I expect the total size to=20
remain the same and the shared portion to drop considerably (actually ~2500=
=20
pages which is not possible since it is only 2107).

My first try was to assign simply a new string: $My::Klaus=3D"y"x10000000;
Now /proc/PID/statm shows for this child:

7749 6718 2107 71 0 5571 0

Not what I have expected. The shared portion remains but the total size gro=
ws=20
by 2477 pages. Well, perl allocates simply a new string. Hence the total=20
process size grows.

My second try was to modify the string in place: $My::Klaus=3D~tr/x/y/;
Now /proc/PID/statm shows:

5307 4276 2107 71 0 3129 0

Nothing has changed much. Particularly the number of shared pages remains=20
exactly the same.

To check that $My::Klaus is really copied on write I have checked the total=
=20
used and free space shown in /proc/meminfo. The figures show exactly what i=
s=20
to be expected. The used memory grows by the amount needed to hold a second=
=20
copy of $My::Klaus.

Hence, killing an apache child when the unshared part grows beyond a certai=
n=20
limit do on linux NOT account the copy on write pages that get unshared.

As I have heard libgtop also only provides the information from /proc. That=
=20
means do also not account the copy on write effect. Is that information=20
right?

Is there a way on linux to get the amount of pages shared among processes b=
y=20
copy on write?

Torsten

--nextPart7348950.5A7Rt56HSW
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)

iD8DBQBCgew/wicyCTir8T4RAlTqAKDKKyRRyNm7E9Ep2OiugNIILjXlMACfcfE/
ND+QmTj/72/8M15IqFUuRVA=
=Ms2O
-----END PGP SIGNATURE-----

--nextPart7348950.5A7Rt56HSW--

(message missing)

Apache::SizeLimit?
Torsten Foertsch 11:27 on 11 May 2005

Re: Apache::SizeLimit?
Perrin Harkins 14:56 on 11 May 2005

Re: Apache::SizeLimit?
Stas Bekman 17:20 on 11 May 2005

Re: Apache::SizeLimit?
Perrin Harkins 17:36 on 11 May 2005

Re: Apache::SizeLimit?
Stas Bekman 17:51 on 11 May 2005

Apache2::Status, B::TerseSize
Matthew Berk 20:03 on 11 May 2005

Re: Apache2::Status, B::TerseSize
Stas Bekman 03:56 on 12 May 2005

Generated at 15:53 on 25 May 2005 by mariachi v0.52