Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:47797 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 80244 invoked from network); 6 Apr 2010 07:11:36 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Apr 2010 07:11:36 -0000 Authentication-Results: pb1.pair.com header.from=tly.phpfans@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=tly.phpfans@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.221.107 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: tly.phpfans@gmail.com X-Host-Fingerprint: 209.85.221.107 mail-qy0-f107.google.com Received: from [209.85.221.107] ([209.85.221.107:58195] helo=mail-qy0-f107.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 08/15-49863-7AEDABB4 for ; Tue, 06 Apr 2010 03:11:35 -0400 Received: by qyk5 with SMTP id 5so786282qyk.2 for ; Tue, 06 Apr 2010 00:11:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:received:message-id :subject:from:to:content-type; bh=cu9urLrd5M8ZgBJmGY34bGhfS3TINl0WekCHzEKSUcw=; b=JoQwbPtD/FEHeRiCiZex7O4M2dYtYW7vsOXnGDemFhNhevU6gZ6KHLvTFUc7AfmeC+ JogJmoXeleF6JOvj/YCmzRisJp2VSUfWQL0iK+orXnJd8GRzb6xagwuLUCBh4CnyTseq BvxBSgDOuky4dWUuIgfIlV6oVgdHPXyTdbmEU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=jBDTjJwluHhFVbaxVtChIVTfBOzWcpReHlCtte5s915K77g7pQs1X79sN/RU/xbSnu mPlglpic70kroC8OEsjv7BFHPc3RWMyuwk0CEdZLZwW8u8fGD77ZB3ZY01kVWX2x6tvQ KpGz+wNdl8gbsfmcCdw/v4oI0bGUje+ONYrNg= MIME-Version: 1.0 Received: by 10.224.6.75 with HTTP; Tue, 6 Apr 2010 00:11:32 -0700 (PDT) Date: Tue, 6 Apr 2010 15:11:32 +0800 Received: by 10.224.35.233 with SMTP id q41mr1724502qad.166.1270537892720; Tue, 06 Apr 2010 00:11:32 -0700 (PDT) Message-ID: To: internals@lists.php.net Content-Type: multipart/alternative; boundary=00163613a1f7c4f2aa04838c27fa Subject: One suggestion to PHP-FPM From: tly.phpfans@gmail.com (=?GB2312?B?6/jCt9Kj?=) --00163613a1f7c4f2aa04838c27fa Content-Type: text/plain; charset=ISO-8859-1 hi, We use PHP's Imagemagick extension to process images, and this would consume a lot of memory under some circumstances. However, the mainstream PHP's memory management is really weak, so a huge amount of memory would be consumed under high server load. What's worse, this even cause our server to crash frequently. So I suggest that if we could add a config option to PHP-FPM, so that PHP-FPM could just kill a PHP process if it consumes too much memory (say more than 256M). This would prevent PHP from consuming a lot of memory which couldn't be freed later. For example, assuming that this option is "exit_on_memory_exceeds", and I set it to 256M. Also, I set PHP's "memory_limit" option to 1024M. I would expect PHP-FPM to kill the PHP process which consumes more than 256M memory, even though PHP could use up to 1024M memory. We have discussed this idea with the author of PHP-FPM,url is http://groups.google.com/group/highload-php-en/browse_thread/thread/1882a3b2257dcc5c/ea73892cea011541?lnk=gst&q=gaochunhui#ea73892cea011541 , and now I have reach my goal by patching the source code of PHP-FPM. So we can edit the php-fpm.conf and add one item such as "3145728" in the "global_options" section, when PHP's memory beyond this limit,child process will exit. mypatch.diff http://docs.google.com/leaf?id=0B-ig5wUi7GTMZTUxYjg1ZTQtOGQ5Zi00N2Q1LTkxODYtYWQ4Y2FiMzhlOWM5&hl=en<%20http://docs.google.com/leaf?id=0B-ig5wUi7GTMZTUxYjg1ZTQtOGQ5Zi00N2Q1LTkxODYtYWQ4Y2FiMzhlOWM5&hl=en> This patch is for http://svn.php.net/repository/php/php-src/branches/PHP_5_3_FPM version: 294187. --00163613a1f7c4f2aa04838c27fa--