Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:122038 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 96897 invoked from network); 25 Dec 2023 18:56:39 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 25 Dec 2023 18:56:39 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id B56C3180051 for ; Mon, 25 Dec 2023 10:57: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=-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-oi1-f176.google.com (mail-oi1-f176.google.com [209.85.167.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 ; Mon, 25 Dec 2023 10:57:03 -0800 (PST) Received: by mail-oi1-f176.google.com with SMTP id 5614622812f47-3b9d8bfe845so3062010b6e.0 for ; Mon, 25 Dec 2023 10:56:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703530597; x=1704135397; 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=heGBc6FLU05jRdyOKvxglFbeDusBCuzwZrIdm3SHtsw=; b=KP5O2gQBXUAC+Ctfipw4a5poef5Fsz7AQup6kN7jjGCsshqdzWXW0oZf5gEHVenSuu b7Ll+6murUAUIBQK1jliTUToGAYKzqRlnjyRqkXgRaPy7chHAXzB6WtNOwl6Y8sz+XG7 bqMdRhfGVAzIXuM/BzxWjrrYxz/gxkbuWfr5fjnzQgWIn1Bpp7Rb472k211pAqVIdCGO /P2XTnUwgQ4feZk+K45hHVjGc85dU5UFaq+joapl0FrcC5W9K7Yhc/dynhO7D8IY9uDH jKg8T5TyqoySSL66CUr6vuWRprSA6LNnE4XYGxgzLKq6KBPUmqXknheDPrzWdZCWmtFL lr9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703530597; x=1704135397; 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=heGBc6FLU05jRdyOKvxglFbeDusBCuzwZrIdm3SHtsw=; b=ntYTaj3wSE3zbUjyRcvWCewjMTTrXrsOqhkSIU6825PSZQXWkHLqNezJHWRD0J01ei BDhhVI+ZM3qMLhGyfmgkWgWeafhyHEJfS9WlL9U/8HkcPlbeJiqq5wBX92ad/n2nKUsI Yok7N76QF0BOhQuj4G1MILrKjfrviiNgu/1sWnwjcwjS0QlzXV0RWCY5RJAXLs14B67g JJJRNoEiuGSol471rHtkGlIMH+61pkH1GPBN618J4io/lcaVrH8wrzYIaCVr2DN2Dhvu HHXQXn5uAwLoP/s0hwjva191cY2O4dofn4c3khtVSOn6ZLVCsEc1ovPbdeFuK9Z5ZnPG 5+xA== X-Gm-Message-State: AOJu0Yxn1nxIBUZtDqKfnvWN5Wbq8tUeZVU3V+J74xXM7raHGz2v6Qak SRX8GPbBbxIfDuUoXP1W0BTBXuLhrOsE4pQxhsfep1gF X-Google-Smtp-Source: AGHT+IE8qhyU/IT7L0EzFqQtlkUoESuqLprXwG/drgluqbzUHlD3OvvwYawQhcit/zveB7dRZISaJkhBmUT+0Qmt4Kw= X-Received: by 2002:a05:6808:d46:b0:3bb:9366:a54d with SMTP id w6-20020a0568080d4600b003bb9366a54dmr5478340oik.117.1703530597476; Mon, 25 Dec 2023 10:56:37 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Mon, 25 Dec 2023 10:56:26 -0800 Message-ID: To: =?UTF-8?Q?K=C3=A9vin_Dunglas?= Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary="000000000000206ce8060d5a203a" Subject: Re: [PHP-DEV] RFC proposal: worker mode primitives for SAPIs From: jordan.ledoux@gmail.com (Jordan LeDoux) --000000000000206ce8060d5a203a Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Dec 25, 2023 at 8:19=E2=80=AFAM K=C3=A9vin Dunglas wrote: > > On Sun, Dec 24, 2023 at 10:44=E2=80=AFPM Jordan LeDoux > wrote: > >> >> >> 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 y= ou >>> keep a PHP application in memory to handle multiple HTTP requests. >>> >>> Worker modes are becoming increasingly popular in the PHP world. Symfon= y >>> (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 provi= de >>> engines supporting worker modes. >>> >>> According to benchmarks, worker modes can improve the performance of PH= P >>> applications by up to 15 times. >>> In addition to FrankenPHP, which is basically a SAPI for Go's integrate= d >>> web server, a new generation of SAPIs is currently under development. >>> Several SAPIs written in Rust (including one by the RoadRunner team) ar= e >>> 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 work= er >>> 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 a= nd >>> 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. Ar= e >> you imagining something that is geared specifically towards HTTP request= s, >> 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 >> > > Ho Jordan, > > Yes, the scope I imagine is geared specifically towards HTTP requests. > Something more generic than common primitives for SAPIs and a shared publ= ic > API to handle HTTP requests with a long-running PHP worker script will be > hard to do outside of SAPIs because they depend on a lot of external > concerns such as the programming language the SAPI is using. > So you want to introduce a SAPI that doesn't work with any of the existing HTTP solutions people use that only supports HTTP requests? Or am I misunderstanding something? This sounds a bit like you want to merge in a tool that is designed for your personal product directly into core. FrankenPHP may be incredible and awesome, but the world runs on Apache and Nginx for HTTP requests. Jordan --000000000000206ce8060d5a203a--