Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:116721 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 50569 invoked from network); 22 Dec 2021 20:40:53 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 22 Dec 2021 20:40:53 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 817AC1804B4 for ; Wed, 22 Dec 2021 13:44:55 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_05, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-ua1-f52.google.com (mail-ua1-f52.google.com [209.85.222.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 22 Dec 2021 13:44:55 -0800 (PST) Received: by mail-ua1-f52.google.com with SMTP id p2so6505400uad.11 for ; Wed, 22 Dec 2021 13:44:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=M7VSTTMJZi6WBhKy2Q01bV2aKaOj5qjCTa85S7Q2BBY=; b=Hh7e9rEj8fvJzmPqZKb7/fVAVCgTuV3xSX0VDoT9U+iRKxcP0e87v9YqwhBuVRUwr9 7f1fednGk5GSy2iPxX8OQjlgF9zd4B+sVGy8HXz2LmS5OH61iEOwya7V4KN5Qv7xiyzp yey2SpN0z6c+ZvEGxymJwV8gOGKQQDUre5dPIiBqxW6pUICCy7dQ5LgVfwypX0O6TFm2 4bgiDgrnXbZb4sNlq3GhEg4hkJqGLwNiKNeeWBo3JtXkqIzaNzwVPkwtv9J7KGdpABpF pR2hlHmLtprIzc0HTpGl3ZbgirZuQpqPBYl0hp0H01G10Wft+hsFG7/iMrkf9z7jvhCH iarA== X-Gm-Message-State: AOAM532pfWFHvlfljwhqEWmWW4JTxmQNEjByixBtnOS+04MGnzlIN/+N YcJdsDC18/xRktECiCO+0fDCUbG7EW4EXWqq3wE= X-Google-Smtp-Source: ABdhPJz1yaK3opc8+RdMjwfNkjuH6rG+RUJisquzJERysgrkJwewYdB4hjOosD+E6eldtkyxRknoWzR9X4lLb3U9T2E= X-Received: by 2002:a67:e09d:: with SMTP id f29mr1580161vsl.6.1640209494383; Wed, 22 Dec 2021 13:44:54 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Wed, 22 Dec 2021 21:44:43 +0000 Message-ID: To: Derick Rethans Cc: PHP Developers Mailing List Content-Type: multipart/alternative; boundary="00000000000045232e05d3c30874" Subject: Re: PHP-FPM process management woes From: bukka@php.net (Jakub Zelenka) --00000000000045232e05d3c30874 Content-Type: text/plain; charset="UTF-8" > >> My suggestion for a fix would be to emulate what Apache always did: >> >> One MINIT/MSHUTDOWN in the main control process (I think it needed that >> to be able to implement php_admin_value and php_value), and then >> additionally also in each worker process. >> > > As I said above, it won't probably fully fix your problem but if you still > want to try to tackle it and move the MINIT, the way that I would do it is > to try to separate the whole sapi init logic and call it from the child > init as the first thing. If you want to experiment with using > php_admin_value before the module minit, then it might be worth to try put > fpm_php_init_child (or just the defines) to sapi startup callback before > calling php_module_startup so the main INIs are loads but it might be a bit > tricky to get worker pool config - it might need some extra globals maybe > for it. But not sure if that's gonna work (e.g. if the main INI files are > loaded at the sapi startup stage) and what will be impact on extensions. > I'd probably have to check it more and try it. Think it's also something > that could happen in master branch only as it's changing some fundamental > bits in FPM... > > After thinking about this a bit more I think we would still need some way to provide the current functionality of the MINIT if that's moved on child level. The problem with not having such step is that opcache shm would be then segmented between children - each child process would have its own shm so it means that it would likely break things like opcache_reset that would work only for a single child but wouldn't have any impact on other children. Also apcu would be segmented and basically anything that uses shm would be in some way impacted. The question is if maybe that single MINIT is actually what's optimal for most extension and that symmetry is just for some special cases which is actually my feeling. In such case it would be probably better to keep MINIT as it is and introduce new step for that symmetry with MSHUTDOWN. By the way that shm sharing on master level is not ideal because this should really be done on the pool level. I have been thinking about something called pool manager (process under master that would manage pool processes in the same or similar way as master does right know) for some time. That would allow this kind of shm sharing except other things. Regards Jakub --00000000000045232e05d3c30874--