On Thu, Apr 15, 2010 at 9:28 AM, Michael Shadle <mike...@gmail.com> wrote:
> On Thu, Apr 15, 2010 at 12:09 AM, Ferenc Kovacs <tyr...@gmail.com> wrote: > > > My suggestion is more about releasing the allocated memory as soon as > > possible. That is, this option is similar to "max_requests". > > PHP-FPM would kill the PHP process if the requests a process handled > > exceed max_requests, and similarly, PHP-FPM should kill the PHP > > process whose memory usage exceeds "exit_on_memory_exceeds". > > > > So one of your lib (for example imagick) leaks memory, on the long run, > it > > will exhaust the memory limit, and will kill a totaly request. > > You can set that how many request should be served with one worker, but > you > > can't soft limit it's memory consumption. > > This is what the patch does: > > if you set the hard limit: (memory_limit) you can guarante that no > process > > will use more memory, because if it tries, it will fail. > > and you can set soft limit, if that reached, the process will die and > > respawn after finishing the current request. > > Sounds like you more or less want a "request_terminate_timeout" type > of functionality but based on memory. Since set_time_limit() and other > things in PHP don't seem to force kill the process. So PHP-FPM > forcefully terminates the process based on the actual wall clock > seconds. > > Unfortunately I don't know how PHP-FPM handles it's worker pool, but as far as with goes with apache php_prefork and fastcgi you can limit how many request should one worker process, but it will be a good option to limit the process lifetime based on the memory consumption. > I'm thinking you're hoping for the same thing to be possible but for > memory limits per-process? I would say that could be cool, either per > pool or per child somehow. Yeah. > No clue if it is possible, but that would > be a great way to limit the usage *forcefully* - helpful on lower > resource machines (like a vps...) > Its possible, the patch adds this functionality to the php-fpm. but I started thinking about, that the possibility to terminate (I mean really terminate, not just abort the execution of the current request) the worker would be a good feature in the php language itself. Tyrael