Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:47953 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 15982 invoked from network); 15 Apr 2010 07:45:44 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Apr 2010 07:45:44 -0000 Authentication-Results: pb1.pair.com smtp.mail=tyra3l@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=tyra3l@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.218.219 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: tyra3l@gmail.com X-Host-Fingerprint: 209.85.218.219 mail-bw0-f219.google.com Received: from [209.85.218.219] ([209.85.218.219:64479] helo=mail-bw0-f219.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F5/44-20494-624C6CB4 for ; Thu, 15 Apr 2010 03:45:43 -0400 Received: by bwz19 with SMTP id 19so16846bwz.1 for ; Thu, 15 Apr 2010 00:45:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:received:message-id:subject:from:to:cc:content-type; bh=XSXswzWzoOwvYTreYFYzT744QKv+0hCJTOq6pbveHMY=; b=AMof/goQlRDkO4VO8iXPkYsJl6teL4LrROxFy85gTU33YuM1+e1ARfi/WyY0p4IVWQ MmjK+YAYQGVGLujIkwMONWxxc/DvR6sPz2LI7qy7558peeceq/sPAex0PWDGihx0XQxU PdutpFANJD8VtUMBa43/y08YxQmTfmB0zufz0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=xiaYaONB8sQY9xSKUvMtNu7fboSz3S9ho3sQcxv7R0b+j9JQhgwKMuVQlSHjT8cXCw a0DZLYuETv4cCs/81ksbnDtxKKkEB1K94eLVf/SQsBmWOOJsMC+e1eoetgzRdWTVlAtN g+BHt/b70Tv3TejujjIWBEb4aPHodxajEd3x4= MIME-Version: 1.0 Received: by 10.204.123.20 with HTTP; Thu, 15 Apr 2010 00:45:39 -0700 (PDT) In-Reply-To: References: <4BC58D10.4050609@lerdorf.com> Date: Thu, 15 Apr 2010 09:45:39 +0200 Received: by 10.204.25.209 with SMTP id a17mr2517515bkc.28.1271317539291; Thu, 15 Apr 2010 00:45:39 -0700 (PDT) Message-ID: To: Michael Shadle Cc: php-dev Content-Type: multipart/alternative; boundary=000325557e1e53844f048441aedd Subject: Re: [PHP-DEV] One suggestion to PHP-FPM From: tyra3l@gmail.com (Ferenc Kovacs) --000325557e1e53844f048441aedd Content-Type: text/plain; charset=UTF-8 On Thu, Apr 15, 2010 at 9:28 AM, Michael Shadle wrote: > On Thu, Apr 15, 2010 at 12:09 AM, Ferenc Kovacs 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 --000325557e1e53844f048441aedd--