Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:53734 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 82524 invoked from network); 3 Jul 2011 13:19:37 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Jul 2011 13:19:37 -0000 Authentication-Results: pb1.pair.com smtp.mail=pierre.php@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=pierre.php@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.213.42 as permitted sender) X-PHP-List-Original-Sender: pierre.php@gmail.com X-Host-Fingerprint: 209.85.213.42 mail-yw0-f42.google.com Received: from [209.85.213.42] ([209.85.213.42:47546] helo=mail-yw0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 28/B2-38479-76C601E4 for ; Sun, 03 Jul 2011 09:19:36 -0400 Received: by ywp17 with SMTP id 17so2062336ywp.29 for ; Sun, 03 Jul 2011 06:19:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=hudlzIDBRAUT63fDkyG/ZCXIu64q0eGPobEWh4GND38=; b=QjH9ZEoeTLzlKbJ7Ldj2xhq73Wm2paI4E0r6lmKaYhfDrtaRv/pisvOxPat1wWBbEe 2WVsHrTp9VLE+D74Fc5hvSXUfnmiTZZIQ7b5iuftcMTnEZHQKlJFBCjILbQMdlrbKbHw iWzQGoMMZQ2M2nJCWjBaJu5T7PUclHdmtzhyY= MIME-Version: 1.0 Received: by 10.146.35.19 with SMTP id i19mr1954156yai.16.1309699172412; Sun, 03 Jul 2011 06:19:32 -0700 (PDT) Received: by 10.147.182.1 with HTTP; Sun, 3 Jul 2011 06:19:32 -0700 (PDT) In-Reply-To: References: Date: Sun, 3 Jul 2011 15:19:32 +0200 Message-ID: To: Giovanni Giacobbi Cc: internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Re: Big patch for FPM (config and initialization) From: pierre.php@gmail.com (Pierre Joye) hi, It is nothing special, you have to use .txt for the attachment. It is also slightly better to create a feature requrest/report at bugs.php.net and attach the patch to it, so it won't get lost into the MLs archives :) Thanks for your work! Cheers, On Sun, Jul 3, 2011 at 3:16 PM, Giovanni Giacobbi w= rote: > Sorry I always forget this mailing list is "special" and strip my attachm= ents... > > Here is a link: > http://pastebin.com/7JpXr22c > > On Sun, Jul 3, 2011 at 02:50, Giovanni Giacobbi w= rote: >> Greetings dear devs! >> >> A few days ago I made my first nginx+php-fpm setup, and I soon >> realized some gaps of the current FPM implementation. First of all, >> the lack of documentation, which of course I know I cannot complain >> about, but this forced me to dig into the source code which in turn >> motivated me to write this patch, which is good. >> >> The patch (attached) is for the current PHP 5.3 svn branch, but if you >> are interested in merging it in I will of course port it to 5.4 >> branch. I don't see particular reasons to apply it to 5.3, I was >> working on it because I'm planning to use it in my production >> environments. It would be really nice if it could make it in the 5.4 >> because it contains also some name changes in the ini file variables >> (with BC of course). >> >> The biggest and most interesting change is for sure the introduction >> of a [defaults] config section. More about this below, first the >> complete changelog of my patch: >> >> Detailed changelog of the patch: >> - Renamed options "pm.status_path", "ping.path", "ping.response" into >> a new logical group "diagnostics", so they are now respectively: >> =A0=A0=A0 "diagnostics.status_path", "diagnostics.ping_path", >> "diagnostics.ping_response". >> - Reordered in a more logical way the pool ini options, from a >> most-likely-to-be-customized first to the least. Usually when you edit >> config file you have big concentration on the first few settings, then >> you go like "blah blah defaults defaults" and so on, so this kind of >> order makes sense. >> - Aligned all the code listings of pool options with the "official" >> order to ease auditing. The "official" order is the one reported in >> the struct definition in fpm_conf.h, which of course is the same as >> the php-fpm.conf.in config template >> - Improved error messages. A better message helps new adopters to get >> started quickly, at the beginning I was really puzzled in front of >> some not very helpful messages. >> - Introduced a new section [defaults] that allows setting default values >> - Dropped restriction of not setting the same value multiple times, >> the last one holds >> - Removed a lot of redundant checks that are logically implied or not >> really required, without reducing the robustness of the program. >> - Improved a lot code readability in some parts, plus added some >> useful comments in the parts that were less easy to understand. >> - Refactored some functions to be shorter from code lines point of >> view, while still doing exactly the same function. >> - Various white space and cosmetic code improvements >> - Moved macros STR2STR, BOOL2STR, and PM2STR from fpm_conf.h to >> fpm_conf.c, no reason to make them public since that's the only file >> using them, >> =A0 so in case we need to change them in the future, there is less risk >> of breaking something which depends on them. >> - Fixed a memory leak in fpm_conf_expand_pool_name() (previous >> dynamically allocated *value was lost) >> >> Now about the new [defaults] section of the config file. >> In the current version if you want to make a decent looking config >> file you have to do something like that: >> >> [global] >> ...your global stuff... >> >> [pool1] >> user =3D pool1 >> listen =3D ... >> include =3D pool_defaults.conf >> >> [pool2] >> user =3D pool1 >> listen =3D ... >> include =3D pool_defaults.conf >> >> and so on, plus of course you need the external file pool_defaults.conf. >> >> With these changes, you can now do something like this: >> >> [global] >> ...your global stuff... >> >> [defaults] >> ...my defaults valid for every pool... >> pm.max_children =3D 500 >> pm.start_servers =3D 10 >> >> [pool1] >> user =3D pool1 >> listen =3D ... >> >> [pool2] >> user =3D pool2 >> listen =3D ... >> >> [pool3] >> user =3D pool3 >> listen =3D ... >> pm.start_servers =3D 20 >> >> >> There is also a small gain in the parsing time, because defaults are >> propagated in memory instead of parsed multiple times as with the >> include files solution. I have to admit this argument is quite >> irrilevant because it's only a startup time overhead, but it's so much >> more elegant in my eyes. >> >> Also by dropping the constraint of setting strings only once, you can >> override your defaults in the pools, so you can have an access log >> format for all of them except one. >> >> >> Upcoming changes that would follow from me if you accept this patch: >> 1) allow '$pool' variable to be used in the [globals], but this >> requires a bit of restructuring because it needs to be lazy-expanded >> in post process time instead of parsing time. >> 2) possibility to include more than one file per section >> >> >> Looking forward to have some feedback from you :) >> >> Kind regards >> >> -- >> Giovanni Giacobbi >> > > > > -- > Giovanni Giacobbi > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --=20 Pierre @pierrejoye | http://blog.thepimp.net | http://www.libgd.org