Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:122070 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 65960 invoked from network); 30 Dec 2023 10:35:12 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 30 Dec 2023 10:35:12 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 17E9A180038 for ; Sat, 30 Dec 2023 02:35:40 -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-qt1-f175.google.com (mail-qt1-f175.google.com [209.85.160.175]) (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 02:35:39 -0800 (PST) Received: by mail-qt1-f175.google.com with SMTP id d75a77b69052e-42813e2dad6so1055071cf.3 for ; Sat, 30 Dec 2023 02:35:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703932511; x=1704537311; 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=tlHvS2tXLzhX01q+LLwVKFeZuuciaOhUwDReeDeonfI=; b=QVY3qSje33JxsndouFxAV0ElGCIjwWXj/Am6UJil/W5UlyqzFz8A8M9FhiAKclFl3K zwPSvrcXLXi5H/2i5P0zN+xdVzrTpzR1r2Owjsoy8QsQL/67QR2P2ezTI1WHgjZx9Uov PXWWwvmPVdE9aGzOZwBNjFXKqfRD632q50QPqFzkjBPlMfjgqSoN2LdZM1typGswcRej uFwGQ7Pre/WUae0jHg41I2dDD/GHywLP/JgI0kEqGStTCr+3NtJQMcs+XhJqewY9a5br Zfbm272kTpe05PtC1pa5CoU4j7B0UWUxF0mc3Msu2gSYbbtGYWjwM1s4+iI3M69nkeuR pxGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703932511; x=1704537311; 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=tlHvS2tXLzhX01q+LLwVKFeZuuciaOhUwDReeDeonfI=; b=wPFy/gLcs4YG3Vy6+4ZI6N7R8FKZrjqe2uwCVi3Kp+BgbCb4bzcxkPlnBOPliArori IfIP4Nq31Id2UQjACG5GvQJ8z7OelxZ2XHxoxHrNtdqXq7WASsEA1jBulyiMoZyh6gzM KOXrdiXeTt3S1YhMb6zvfzBDVNehWNKr8YfedO9CdIxapK2v9Q2FpxaHuVdOjVTf4fKE 9jTkrG3DYg8tor4RBZmV/d1vESnGsRh+oXleF5lLzlv8t1DrH1xp0zqmpuRksNg+JGMD ofsa4fwBRAkgF0QpwhDKH1qtQTT2XZ6WaGEuw+xBqfVxMTcycrbjKWLHEyr1PJFUj4W6 msLw== X-Gm-Message-State: AOJu0YyS/hTOryVgLvcwfpm/2+z4YhZVBWbOmzHHT/qt9wpvl4jOq30i 2/+Z9p6aROqOZeTwmCSTxs+zBenC1AiXttD9FMo= X-Google-Smtp-Source: AGHT+IHbLdTO9yqvngbOh6R21r4/oKow7Y3jmAO64Z8aoP57Kb/fCsgRa0YkouqNWUCdR+HCQZOGz3bKkicVVjkL7MU= X-Received: by 2002:ac8:5a11:0:b0:428:142f:356c with SMTP id n17-20020ac85a11000000b00428142f356cmr246408qta.48.1703932511103; Sat, 30 Dec 2023 02:35:11 -0800 (PST) MIME-Version: 1.0 References: <5060b986-2e5a-46e4-9c83-763e5b155e83@gmail.com> <6f7815b9-80cc-4e08-819a-49dca090116f@gmail.com> In-Reply-To: Date: Sat, 30 Dec 2023 11:35:00 +0100 Message-ID: To: Robert Landers Cc: Rowan Tommins , PHP Internals List , =?UTF-8?Q?K=C3=A9vin_Dunglas?= Content-Type: multipart/alternative; boundary="0000000000000badc1060db7b448" Subject: Re: [PHP-DEV] RFC proposal: worker mode primitives for SAPIs From: michal.brzuchalski@gmail.com (=?UTF-8?Q?Micha=C5=82_Marcin_Brzuchalski?=) --0000000000000badc1060db7b448 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Robert, sob., 30 gru 2023, 10:59 u=C5=BCytkownik Robert Landers napisa=C5=82: > > > - 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 tha= t > > 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 don= e > > > 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 int= o > > 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 inpu= t > > 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. > That is certainly not true. Looking at WSGI or ASGI there is no need for request response objects. These can be provided in userland which gives more flexibility cause of different rules governing over bc break policy in PHP core. Name one true argument to convince me in this topic and I may change my mind. For the years I had the same impression but on low level the primitives are more flexible and we all know that. Cheers, Micha=C5=82 Marcin Brzuchalski > --0000000000000badc1060db7b448--