Re: Limiting Memory Use Per Process/User
On 5/4/05, Artur Kokoszka <email@example.com> wrote:
> Stephen Le wrote:
> > On 5/4/05, nodata <firstname.lastname@example.org> wrote:
> >>>I was wondering if there was a way to limit the amount of memory used
> >>>by any single process or user. I'd like to prevent Apache (and other
> >>>server daemons) from consuming all available memory and thrashing my
> >>>disk when everything else is forced to swap.
> >>>For example, I'm currently testing the coppermine image gallery
> >>>software. It's written in PHP and uses ImageMagick. Whenever images
> >>>are uploaded to the gallery, it spawns a number of fairly large
> >>>/usb/bin/convert processes under the 'www-data' user name. These
> >>>processes consume all available memory and result in disk thrashing
> >>>that brings my server down to a grinding halt. Is there a way to
> >>>prevent this from happening?
> >>ulimit -a, but that's probably not a good solution for this.
> > ulimit only applies to commands started by the shell. If Apache (or
> > any other daemon) spawns a child process, would ulimit apply to them?
> > I would really like to set a 'max memory usage per user' or 'max
> > memory usage per process' setting.
> Try PAM module:
I think the PAM module only applies to commands executed in a shell.
Will they also apply to the server daemons (normally started through
/etc/init.d) and the children they spawn?