Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:122031 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 26687 invoked from network); 24 Dec 2023 21:44:33 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 24 Dec 2023 21:44:33 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 285D518004E for ; Sun, 24 Dec 2023 13:44:54 -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, 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-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) (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 ; Sun, 24 Dec 2023 13:44:53 -0800 (PST) Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-6d9af1f12e8so156859b3a.1 for ; Sun, 24 Dec 2023 13:44:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703454268; x=1704059068; 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=H9FVCI3GPGLV60z2gzrabeRarwkh4Kv7Gu98cnBbiN0=; b=htCO6Nc+b+IwJdP6BOvB+mFG4G0OgapeSu8FekubptFKpTPTcgVTV+3Rdom5MCwKnv 8h4hrR1uM7RK2Tr/s16MNzdVXbMbsf+S3NswBeqknxDEiLgg/XRoej27YhGeof89hyeZ qBhxFcYz65/COTlM87lgt98i01Gbl+5xvLr5dK1xwEEDP3+suIlxnUfWqzGzX6Vb3xkP nuIqWOqQhxGN6s2DrQ6dY4KrP0XoAV9uBwqH+oF6kwZR6/3FJ7D7QZXRXFBgxSJ1V1wK dAbmtU2NVenGknWFh1PNAFWc+FnZZnorQuLt5MxWge8MIIG9IbvGLRo2PIv5dxROP3FD K9ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703454268; x=1704059068; 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=H9FVCI3GPGLV60z2gzrabeRarwkh4Kv7Gu98cnBbiN0=; b=tBlV82IAu3mhhj+68XXyM4FgmvVPXTZ+8Fhs02dls/GHx1REmUbMowgouwEKwgDAWa l7s1K1PnxWyoHDBPSMq8IyS2f0yUDH+MShoYDuJDBD0D+uhGJbtbTeCdnXos20oew7pT D2A90QnHwgz1EKTTSTw0qUNTy2JmE7kns/NPZqCYGg+qkbDh5uo04qlcAJBIRe7O075b qGYA956Ed1flj0naikgDf0AptcMHmWfOPboTeQRkdsSGZbGW8LWaBgEANivVIY8JOHYU K64ml1bhedcuuM+BS3EPOylOJSFLeUSGJ+wuEGsaFW8ofWCfSdwuw5bp67rs6hZOl0kR oYOA== X-Gm-Message-State: AOJu0YzNuf4SZ1XRY3tnD6HdWoV9+naRixS2yWhR2C0wHoVVR6LhGnN/ 2d4uGowOzhE61+BniHQ5NF9DgCmWRq6MqQu55LR/RSiU X-Google-Smtp-Source: AGHT+IFiBjzbb8LvPBd/URmxbOwpYL+NPTtutCpysFxmpyG4SQvXXwhxtsxTvoaEyEif9Y46AYu4RiRKO2Jgll3+9Ro= X-Received: by 2002:a17:90a:4708:b0:28b:be23:67a6 with SMTP id h8-20020a17090a470800b0028bbe2367a6mr1555661pjg.80.1703454268145; Sun, 24 Dec 2023 13:44:28 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Sun, 24 Dec 2023 13:44:00 -0800 Message-ID: To: =?UTF-8?Q?K=C3=A9vin_Dunglas?= Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary="0000000000008b49ec060d485a3a" Subject: Re: [PHP-DEV] RFC proposal: worker mode primitives for SAPIs From: jordan.ledoux@gmail.com (Jordan LeDoux) --0000000000008b49ec060d485a3a Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sat, Dec 23, 2023 at 12:34=E2=80=AFPM K=C3=A9vin 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, > -- > K=C3=A9vin Dunglas > Much like Larry, I'm curious what sort of scope you imagine for this. Are you imagining something that is geared specifically towards HTTP requests, or would this be a more generic "PHP Application Worker" that might be spawned to handle other types of applications? Could we have a worker listen to a specific port and respond to or handle all requests on that port/device? Jordan --0000000000008b49ec060d485a3a--