memory limits

Sten Spans sten at blinkenlights.nl
Sun Sep 5 16:32:14 PDT 2004


On Sun, 5 Sep 2004, Adrian Nida wrote:

> Hi there,
>
> I'm running a very memory intensive php 5.0 script through apache2 on a recent
> DragonFly build (Sept 1).  My problem is that I'm running into some OS limit or
> something.  I'm assuming this because I have 2G physical RAM and 4G swap, but
> apache runs out of memory waaaay before then (maybe 500MB) even though top
> reports 1400M Free.
>
> I've tried setting datasize to 'infinity' using `limits`, but that didn't stick
> (I ran it again, and it still said datasize was limited to 524288).  I also
> tried to adjust kern.ipc.shmmax to 6GB using `sysctl`, but it didn't make a
> difference.  FYI, that variable's upper limit is 2147483647.
>
> What can I do to give apache2 access to all the addressable memory on this
> system?

Default FBSD/DFBSD kernels limit memory per proces to 512MB.
LINT has info about MAXDSIZ and friends.

Apache shouldn't normally be affected because it forks children,
aka seperate processes (dependend on mpm of course, but a threaded
apache is not normally desirable on BSD, more so with mod_php )
Four of these should be enough to use all your memory.

Having apache in swap on a busy webserver isn't quite that desirable.

I'd suggest rewriting the script, and making it a daemon/cronjob/whatever.
There are things which apache can do and there are things it shouldn't.

-- 
Sten Spans

"There is a crack in everything, that's how the light gets in."
Leonard Cohen - Anthem





More information about the Kernel mailing list