Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:122044 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 17326 invoked from network); 26 Dec 2023 01:44:34 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 26 Dec 2023 01:44:34 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id BDAA418004F for ; Mon, 25 Dec 2023 17:44:58 -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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,SPF_HELO_PASS, SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail.online-presence.ca (online-presence.ca [216.128.176.244]) (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 17:44:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=online-presence.ca; s=default; t=1703555072; bh=187qEJii2dkNfTQUP5ByYO7Wd2AERGwnXKv6KLkHSoM=; h=Date:Subject:To:References:From:In-Reply-To:From; b=fugK2/+0lIQp8cgZrsMgCeQNlaKVSR9qTW50Y8QOipo546zkbAclpThXaZVe5VxY2 7vlaPvDjflVuBgPyTNL/vy4dYYU7s+BfWwWSEMikobWPHA/5tFwYdgjgwsnSPJw5fm KoHB9zljem6R+3CyIbdvAtkr3LKHW6W0TtQvXbL3gMsM0Sr5D3mALNtWjm6EU+qPIl R92lpoTZ7EggSeeGsyFCItn/1P3y49OqBaWZI8RAuUKz0zmoeDTE+Ml1hWh1H1lTtu j9k+1tuU+B4MxUX5OssJiXrr/+id9Yoop5ZS7TU3nLwiNP22n4BTpRTGinjH7x7J/b G7F96fbMuEFpQ== Received: from [10.0.0.211] (S01064075c3d865eb.ed.shawcable.net [70.74.109.64]) (Authenticated sender: lanre@online-presence.ca) by mail.online-presence.ca (Postfix) with ESMTPSA id 521FC105DB5 for ; Tue, 26 Dec 2023 01:44:32 +0000 (UTC) Message-ID: <99bfef64-47d2-420e-96dd-8a63caa6d886@online-presence.ca> Date: Mon, 25 Dec 2023 18:44:31 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: internals@lists.php.net References: Organization: Online Presence In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] RFC proposal: worker mode primitives for SAPIs From: lanre@online-presence.ca (Lanre Waju) Why not just build this into the embed sapi instead? since its only for third party sapis? On 2023-12-23 1:34 p.m., Kévin Dunglas wrote: > Hello and Merry Christmas! > > One of the main features of FrankenPHP is its worker mode, which lets you > keep a PHP application in memory to handle multiple HTTP requests. > > Worker modes are becoming increasingly popular in the PHP world. Symfony > (Runtime Component), Laravel (Octane), and many projects based on these > frameworks (API Platform, Sulu...) now support a worker mode. > > In addition to FrankenPHP, projects such as RoadRunner and Swoole provide > engines supporting worker modes. > > According to benchmarks, worker modes can improve the performance of PHP > applications by up to 15 times. > In addition to FrankenPHP, which is basically a SAPI for Go's integrated > web server, a new generation of SAPIs is currently under development. > Several SAPIs written in Rust (including one by the RoadRunner team) are > currently under development. > > These SAPIs, along with existing SAPIs, could benefit from a shared > infrastructure to build worker modes. > > > > The FrankenPHP code is written and should be easy to move around in PHP > itself, to enable other SAPIs to use it. > > In addition to sharing code, maintenance, performance optimization, etc., > the existence of a common infrastructure would standardize the way worker > scripts are created and provide a high-level PHP API for writing worker > scripts that work with all SAPIs that rely on this new feature. > > SAPIs will still have to handle fetching requests from the web server and > pausing the worker to wait for new requests (in FrankenPHP, we use > GoRoutines for this, in Rust or C, other primitives will have to be used), > but almost everything else could be shared. > > For reference, here's the FrankenPHP code I propose to integrate into > libphp: https://github.com/dunglas/frankenphp/blob/main/frankenphp.c#L245 > > The public API is documented here: > https://frankenphp.dev/docs/worker/#custom-apps > > I'd like to hear what the community thinks about this. Would you be > interested in this functionality in PHP? Should I work on an RFC? > > If there's interest, I can work on a patch. > > Cheers,