Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:122027 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 75187 invoked from network); 23 Dec 2023 20:34:41 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 23 Dec 2023 20:34:41 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id C5327180031 for ; Sat, 23 Dec 2023 12:35:03 -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.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DMARC_MISSING,HTML_MESSAGE,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-qv1-f47.google.com (mail-qv1-f47.google.com [209.85.219.47]) (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 ; Sat, 23 Dec 2023 12:35:03 -0800 (PST) Received: by mail-qv1-f47.google.com with SMTP id 6a1803df08f44-67f848f38c4so18361036d6.3 for ; Sat, 23 Dec 2023 12:34:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dunglas-fr.20230601.gappssmtp.com; s=20230601; t=1703363679; x=1703968479; darn=lists.php.net; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=omXfKFsRvh7Jh9i9hk3KNSTK8AbZbITUcsa9eWVjVYs=; b=FIN4jiog8bvt5tjxfBbxIaay4SSoMErLS9/0tXAduKpOH8b2ynNx3Vfat95QyEDz+W hQqnIHXI9AFcPWnfpk8NwlsvbJt/Ut2YiytUrc5fTU2HWEGjH9jG6rcyf2pfm7c0CxMF ke7OvlS0z/3VFcjpMWZ4Q0M8ub9u+MoixNqiRl973plDepE4oizUnws0b0mzKiwEN/hD a1FE40b4MUOBn1IX6uHGMz8g70gR5FY9qK1jUSmsThNZnBt6IHyMHnMtkfUr5bhux6AN pJar+7TalS5PsSEDpf1uWXV8X90ve7B28eqeBnPCjZNon258fndauQkNXBfCUBHMsUIb ak+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703363679; x=1703968479; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=omXfKFsRvh7Jh9i9hk3KNSTK8AbZbITUcsa9eWVjVYs=; b=oZExC5C1TRXdjxIIwhTMnVwyK38Halg/CGWohUuFVNXL6DtrsAM3AaivYMv6ay3+lT 6AfBalEllMexXR/5G9WgXQT22yQeSBOUOIAhH0iYyeCIPljzR/rE0ZYhBxEYugdzaoc6 3DFe2WBMFShOm5I17LyKnApPcwqWuBaIsWousCjNJkRJ3yil9n32XrbZ97sHEPthx/ut 3aVIbGgTb3vUiDE/4E/1wvZYuHfBS1+jvz59vfykum/nMCu5U/ulGhUK8+8MWmRl7y3N LW3XQmh9YIQHUHVxM96uchty5BKdj58CHkrLFe3NkkhTgvyKBIf2VmpljSoOnSNy2sF9 G+og== X-Gm-Message-State: AOJu0YwYXeTxzn+AY/Hgt6Fge5uV9oW9KQ7UEuy7aJr+X4QBu0j/TFK+ 978pkh2euTLpbuJUZ0L+CbjY6t1yMwi4Pe24QFBNgKizaBFS0I0hTIq9XVYdTz8= X-Google-Smtp-Source: AGHT+IGKnm0PD9JlsvNSu829RBeb5cD8ZdfOFwptJcJk2Us6ZgGwwcpU0EUzu02itUgZLBdLyNWFJwTbx273ShamvYs= X-Received: by 2002:a05:6214:d66:b0:67a:a721:7837 with SMTP id 6-20020a0562140d6600b0067aa7217837mr4857673qvs.92.1703363678667; Sat, 23 Dec 2023 12:34:38 -0800 (PST) MIME-Version: 1.0 Date: Sat, 23 Dec 2023 21:34:28 +0100 Message-ID: To: internals@lists.php.net Content-Type: multipart/alternative; boundary="000000000000fd9613060d33425a" Subject: RFC proposal: worker mode primitives for SAPIs From: kevin@dunglas.fr (=?UTF-8?Q?K=C3=A9vin_Dunglas?=) --000000000000fd9613060d33425a Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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, --=20 K=C3=A9vin Dunglas --000000000000fd9613060d33425a--