Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:122068 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 61919 invoked from network); 30 Dec 2023 09:59:22 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 30 Dec 2023 09:59:22 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id E1870180055 for ; Sat, 30 Dec 2023 01:59:49 -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,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-oo1-f53.google.com (mail-oo1-f53.google.com [209.85.161.53]) (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, 30 Dec 2023 01:59:49 -0800 (PST) Received: by mail-oo1-f53.google.com with SMTP id 006d021491bc7-5954039fd01so286233eaf.2 for ; Sat, 30 Dec 2023 01:59:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703930360; x=1704535160; 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=eCRbtrTyWPGJJrL2tm93TLunCeDg7ScnKf/PdqU18Pk=; b=kU0EhZ8FZ/gJSFeDmrNHDERp7X58RK3AvGydczwJqzztlAHvR8LJ2td89b+UqMVDNu jm4bqfny08XePwaJPqfW1P4yAg4OMGZb6TT+4jAXxY2miOTisgLNtromqKSk0f07bGAz 5/wuzIiW+dlPEuMOJK4DO9rXWM8Q794/ZyxZ0YlWuWXA0RAmJ3SyhypVcPhdWLkdGyE/ jK5PDbYbfe8AqwrgIXMRbf3GVUjJXz7EOnajmnwvUWZrjzzywTO1iYYA2Gze1PNNMLZv xaETGllxCmaZ+Y8d1dySd1CCNf0yO1jzI5fzvRHHYs43mka3OaEWmw0VFaivvj25nzzi TOuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703930360; x=1704535160; 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=eCRbtrTyWPGJJrL2tm93TLunCeDg7ScnKf/PdqU18Pk=; b=IRmYWuaRsgflLpXoqtSp+RAhbNf/fFgoWqql2K/HtFAm21LjZttV+7smes5o9cUxfV 3IcP79J9bJtiYxrOeNeIiZj3vYLPpOwDTD5C4yFsNA2mVgqG36v7ksG5U0MIGbKye6op EsytClFwGeecgLHdTsdp6kYYf9sYsGp3+Xrq9MVhsi5ueuBh8+r08fLI/hx32yn+PEbl ZnqDsUW5hRxj7SKpcCVgZVI3ronxUkc2LOthD7HF0M9GsD1ru6Mg8wznz2JyH7RjuBwY xdpHGGBmqqCYtnLQMLAfBa6bQSq1nC5fD8IoWIrtmYTTe44z7l0wuE4nzf4lzQdSBXux T/Ow== X-Gm-Message-State: AOJu0YyNj/IXSOUHblS+mjMxB+rARlTlSI/DNutzQXq40xtMe2MuS+k0 PzHI9qx7MVJffDZdpJfgCJz2C9sQIrjIEwPyvVpLl7XsCz66CA== X-Google-Smtp-Source: AGHT+IH0Az1Y0mUu8sp9/J6NDgPWtyq9LT1q1Wk85H5q+yoE+7ZC31aGN9qgfq5Atu3TL9bOx1EWRLQoKHsGoUiht9E= X-Received: by 2002:a4a:57c1:0:b0:594:35b8:5fb9 with SMTP id u184-20020a4a57c1000000b0059435b85fb9mr5335801ooa.15.1703930360425; Sat, 30 Dec 2023 01:59:20 -0800 (PST) MIME-Version: 1.0 References: <5060b986-2e5a-46e4-9c83-763e5b155e83@gmail.com> <6f7815b9-80cc-4e08-819a-49dca090116f@gmail.com> In-Reply-To: <6f7815b9-80cc-4e08-819a-49dca090116f@gmail.com> Date: Sat, 30 Dec 2023 10:59:07 +0100 Message-ID: To: Rowan Tommins Cc: internals@lists.php.net, =?UTF-8?Q?K=C3=A9vin_Dunglas?= 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) > > - FrankenPHP expects the user to manage the main event loop ... > > > > > > This isn't exact. FrankenPHP does manage the event loop (the Go > > runtime manages it - through a channel - under the hood). > > > Perhaps "event loop" was the wrong term; what I was highlighting is that > to use FrankenPHP or RoadRunner, you have to write a while loop, which > explicitly handles one request at a time. In Swoole, there is no such > loop: you register event handlers and then call $server->run() once. > Similarly, WSGI mandates that the server "invokes the application > callable once for each request it receives from an HTTP client". > > It's a distinction of pull/poll (the application must actively block > until next request) vs push/subscribe (the application is passively > invoked whenever needed). I think these models have different capabilities: A pull/poll model is quite simple, while a subscription model is usually more complex. With something simple like in FrankenPHP, creating a Queue SAPI, a WebSocket SAPI, etc isn't far off, where someone writes some PHP to consume a queue or websocket connections. > > I already replied to Crell about that. It will totally possible to > > expose more complex HTTP message objects in the future, > > but PHP currently lacks such objects. The only things we have are > > superglobals (which are more or less similar to CGI variables, as done > > in WSGI) and streams. It's why we're using them. > > > The use of objects vs arrays wasn't the main difference I was trying to > highlight there, but rather the overall API of how information gets into > and out of the application. FrankenPHP is the only server listed which > needs to reset global state on each request, because the others > (including Python WSGI and ASGI) use non-global variables for both input > and output. > > I notice that the Laravel Octane adaptor for FrankenPHP takes that > global state and immediately converts it into non-global variables for > consumption by the application. For this to happen in PHP Core, there would need to be request objects instead of a global state. If an RFC implementing PSR requests/responses in Core is a pre-requisite for enabling what we're discussing here, I'd personally be all for that (as would a very large chunk of the PHP community, IMHO). I personally think this is a chicken/egg type of problem though. It doesn't make sense to have request/response objects right now, and I get the feeling that people would only support worker mode primitives if there were request objects... so, it might make sense to build a v1 of the worker mode primitives and then iterate towards request objects, because then there would be an actual need for them. Robert Landers Software Engineer Utrecht NL