Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:122041 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 10336 invoked from network); 26 Dec 2023 00:09:50 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 26 Dec 2023 00:09:50 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 63CAE180051 for ; Mon, 25 Dec 2023 16:10:14 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-yw1-f171.google.com (mail-yw1-f171.google.com [209.85.128.171]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 25 Dec 2023 16:10:14 -0800 (PST) Received: by mail-yw1-f171.google.com with SMTP id 00721157ae682-5ec7a5a4b34so4132327b3.0 for ; Mon, 25 Dec 2023 16:09:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703549388; x=1704154188; darn=lists.php.net; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Wd1yGxelVuBMXkbMdTybzj3lHG/CPy+nBO/au4sdoB0=; b=RRglF74btMg/+7eVWIwnow89u+1+62QQwdKHW2lhpQY3AMRNLJTJ4mUF8zi4fEYOLL YWBBi0QO4QC8swLqYnfoY2yo7AiXUAHsp3UdStwXJwC+i8tLFTZlkMflf5yll/0BqOKa KB00V+RXf5dt9KuG2J4LtbfJ1B94QgapTQQzTsE/mWvK7z8XEQr5q8tgsTY7jR5XFom4 MwE94mOd8kFEPm4Hq6rFCRO56N/+1nduiJ0/NCaRuatf5aJTq7H6nvz+I9W/MTsuPTxN rgqmhWcuguJkwxoAqnQosouDPM7elVoTxcB5po/Dx7+Av8zWuQAEDAW7ODTBEC1GHcEm B5VA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703549388; x=1704154188; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Wd1yGxelVuBMXkbMdTybzj3lHG/CPy+nBO/au4sdoB0=; b=EaAivXcDxEO1UMOvIuaiTApb8z/YkO7aq+jaQoZWSlvZTTCfm+6eLh4hQAtwrOEfur zCMq8+f+NgJgAaElRQ9dK8fzC/HjgHql+vPAGTHbP1t60YG92bj67RZ4hNh3xfl2JdN/ WsrwA1ciKTD8immDGGygDKvsy81GFnac39JK70VlqBSYaL5ElDYIvCXwF0Sm3HSLAZIV BVSSMTouCqFsUaiuJ+F54bldSCfz/6cFiJErHOnmYyvCJBgphS8GQ/SsunDtcPoexo80 db3GexF5JvbwB2c5+ccsq66Vrd4VCY7TsBMP7sPd7AFwgyYKHlNqu163Q0rUDl10+HNL CVBg== X-Gm-Message-State: AOJu0YyIgLaTcFrbhXmnWbQr7LiFdnlTFmRGpltVUlCmJQP9c3N9dxFi N2jjFUdLpY/8BkzoMiJHZskQzPKdNc/r0zER20w= X-Google-Smtp-Source: AGHT+IFYLEYGWOklggeYk2xKZxcc2kk6krkTOjAESVDL//B/ul1h1E/wjSZ5psQi7bOx0M+3guAUXRnUcdATqn38XU8= X-Received: by 2002:a81:7346:0:b0:5e2:b4f2:a203 with SMTP id o67-20020a817346000000b005e2b4f2a203mr3457321ywc.96.1703549388115; Mon, 25 Dec 2023 16:09:48 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 26 Dec 2023 01:09:37 +0100 Message-ID: To: Jakub Zelenka Cc: =?UTF-8?Q?K=C3=A9vin_Dunglas?= , Larry Garfield , php internals Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] RFC proposal: worker mode primitives for SAPIs From: landers.robert@gmail.com (Robert Landers) Hi Jakub, > I have been thinking about something similar for FPM and if you had some > sort pool manager process, you could maybe do some sort of initial > execution but then it gets really tricky especially with sharing resources > and managing connections. I think it would be a big can of worms so I don't > think this is going to happen anytime soon. It's already happening. Most libraries (particularly popular ones in the Symfony/Laravel world) already support most of this out-of-the-box. I love stateless servers, but sometimes a stateful server is better. What is really nice about worker mode is that you can actually have a PHP-native in-memory database that only exists for as long as the worker is running (I do this for some unit tests). > I could imaging that there will > be similar issues for Apache prefork which is likely the most used MPM for > legacy apps. Effectively it means that this function won't be working on > most installations as two of the likely most used SAPI's won't support it. > I think it should be pretty clear from the beginning. Most people are familiar with fastcgi_finish_request() and there are some built-in SAPI's that don't support it. I don't think that just because it won't start out with full support, it should be discarded. > It would be also good to put together some base design PR for this as > currently SAPI common functions are implemented separately in each SAPI > (e.g. apache_request_headers). From the linked functionality, it is is not > a big amount of code and seems somehow specific to the FrankenPHP so why > couldn't each SAPI just implement this function separately? I know that > this is not ideal but it's what is already used for apache_request_headers. > I think otherwise you would need some hooking mechanism that should have > some default (which would probably just throw exception) because it is not > going to be implemented by all SAPI's. I think it would be really good if > you could provide more details about planned implementation for this. Most (all?) modern SAPI (lightspeed, roadrunner, etc) implements fastcgi_finish_request(), even if no fastcgi is involved, simply because of backward compatibility. It'd be great to actually bikeshed a decent name and syntax/semantics before something popular comes along and forces us all to use frankenphp_handle_request() or something, simply because of backward compatibility. I think this functionality unlocks some really cool potential powers (in-memory databases for development, connection pooling without an extension, etc) and it's worth at least seriously considering implementing it in core. - Rob