Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128949 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by lists.php.net (Postfix) with ESMTPS id 1683D1A00BC for ; Fri, 24 Oct 2025 10:11:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1761300700; bh=InitXxteDVCOQMFsBQS6Bhin/cKsBwT4aBMaDnVFWuk=; h=Date:From:To:Cc:In-Reply-To:References:Subject:From; b=gmmMYwkedlsD8PnpsWGqqxxqMCf2MFeoSRJxOwfN9x0V6clXWIgsqrsbwKYmdxWyq s8F1Du9HxMbXRN/6yXsW54a0PL/bPWTPr5Vc1CkWcEneDdTuqFmAqosHvJEfy3PKAK mpeaEl1WOc19Ig7e/4KOezXjKQg89Fw6joogpeH1S6993duXgbi2CP0RPhv8PcegyU sR+ErLUfeLCvwzpN37azNHaQzya0cAdlmkjHE5GPX11DkD4OiOgsQXlhmb8pQh3iUl qNDWng5Wa2G5NGFGuABnjnvBBdKztGcbcN0L9kX0OGy9VOYgu/hQV46NWPgC7uk00N AfGlYlEj2qL9A== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id D1BB01801E9 for ; Fri, 24 Oct 2025 10:11:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,HTML_MESSAGE, RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS, SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from fhigh-b8-smtp.messagingengine.com (fhigh-b8-smtp.messagingengine.com [202.12.124.159]) (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 ; Fri, 24 Oct 2025 10:11:39 +0000 (UTC) Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45]) by mailfhigh.stl.internal (Postfix) with ESMTP id 090B97A0088; Fri, 24 Oct 2025 06:11:34 -0400 (EDT) Received: from phl-imap-05 ([10.202.2.95]) by phl-compute-05.internal (MEProxy); Fri, 24 Oct 2025 06:11:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bottled.codes; h=cc:cc:content-type:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm3; t=1761300693; x= 1761387093; bh=InitXxteDVCOQMFsBQS6Bhin/cKsBwT4aBMaDnVFWuk=; b=v N9tpy7jX/RmFw4lnthQmP6Sj3FDnbQRA3kZJet6CP9xERuVpb/rJY32V9aI386KR 2xPKqdkr5ooqXeMDDiUmiONZ88isqKdiWoNdsncHvJV4Nfdivd0iVaAUmG1etzlQ lG6bqoHeXKNY3crt9V++QclsceP8oR4WMipFBMBj4Pw833nvEjuAkZWwpPFJ+tfZ 0bdN8tpdum4KUvWVjP51xxSS8EOGQTe0uQcw9pxRib+yA9fQ2sg9q4GNi//7+yT1 IEHadhbzalOJBcu1+Tfrz7Fjgsiv40/sJ7QyGQMuZhPZRUpvNBI6VrzjCf/hoePh /eRCi9VootPm+VgLVMM1w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1761300693; x=1761387093; bh=InitXxteDVCOQMFsBQS6Bhin/cKsBwT4aBM aDnVFWuk=; b=Jv0pyAptVucq6cPp/fD/wJMpwIbcJfFxZvOodSrr8i3+VRnCnGg R1zMFHGNQkZySfhDyYIIaMYfy7r0jIZPACQvYmaD4SS648Ga0QgjCNgIZhU+kcSt eohMkb6lxA8N0klHX259HFLI6QfHsUpjNXeD0tFQGxeOgKJTuB4cnxCj6Pn/9NyM ykVgMcGUB0Qap3ONKv6+eB1PvwSgB9gZ8fJ0JXJLzcpaxeblhZ5zaH5aJNdMOkpE nHyR8wzy/NAKPBtfQKKS3OLX4aev8XYW/IvMGUkbo+hfjhEokPS95FOLMyobVm0y /lSfsNkjh6MNv1zqcyFWGtpaP5ih0uuKQgw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggddugeeltdejucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepofggfffhvfevkfgjfhfutgesrgdtreerredtjeenucfhrhhomhepfdftohgsucfn rghnuggvrhhsfdcuoehrohgssegsohhtthhlvggurdgtohguvghsqeenucggtffrrghtth gvrhhnpeeiueethedvvdefjefhgfeiheelheehtdfhfeekjefflefgvedvkeduteejjedt tdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehroh gssegsohhtthhlvggurdgtohguvghspdhnsggprhgtphhtthhopedvpdhmohguvgepshhm thhpohhuthdprhgtphhtthhopegvughmohhnugdrhhhtsehgmhgrihhlrdgtohhmpdhrtg hpthhtohepihhnthgvrhhnrghlsheslhhishhtshdrphhhphdrnhgvth X-ME-Proxy: Feedback-ID: ifab94697:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 6F6B51820074; Fri, 24 Oct 2025 06:11:33 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 X-ThreadId: Ao23bsqP5RK3 Date: Fri, 24 Oct 2025 12:11:13 +0200 To: "Edmond Dantes" Cc: "php internals" Message-ID: <85376b2e-88f1-4e63-a8a5-f50ab23100db@app.fastmail.com> In-Reply-To: References: <0c852933-607a-4d50-94a8-641a3318f3c9@app.fastmail.com> Subject: [PHP-DEV] Re: PHP and parallelism Content-Type: multipart/alternative; boundary=6cf5f86835084403b0e9b17b6c086945 From: rob@bottled.codes ("Rob Landers") --6cf5f86835084403b0e9b17b6c086945 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Fri, Oct 24, 2025, at 11:43, Edmond Dantes wrote: > > > > So practically speaking, it=E2=80=99s not worth designing around thi= s yet. The engine would need massive adaptation before userland could sa= fely talk about =E2=80=9Cparallelism.=E2=80=9D > > >=20 > I agree. However, this question was raised. Perhaps there=E2=80=99s a = larger > team of developers working on a new virtual machine for PHP? I don=E2=80= =99t > know anything about that. But if that=E2=80=99s indeed happening, then= the > topic becomes relevant. >=20 > As for me personally, I don=E2=80=99t see any practical benefit in int= roducing > multitasking to PHP. It would require significant development effort > while offering very little economic value in typical PHP use cases. > Still, it=E2=80=99s possible that someone plans to build a PHP-Native = version > for a wider range of operating systems =E2=80=94 and in that case, suc= h a > feature might indeed be needed. >=20 > --- Ed The only thing that is relevant to this discussion (that I know of), is = my refactoring of TSRM so that FrankenPHP doesn't need to maintain it's = own thread pool of PHP workers. It's only relevant because it takes away= the thread-local bits and makes it possible =E2=80=93 not that you'd ev= er want to do it, unless you like segfaults =E2=80=93 to run the engine = concurrently across multiple threads. With a decent preemptive scheduler= (this is distinct from the userland/TrueAsync scheduler), you could pac= k multiple requests in the same thread while waiting on I/O, and have a = different thread pick up work if the I/O finished too early. This will b= e entirely transparent to userland and other than TSRM changes and a few= convienent hooks, be handled completely by a FrankenPHP (or even, Swool= e) scheduler. Where this intersects with TrueAsync is being able to further pack corou= tines (and especially "native" coroutines like file_get_contents(), PDO,= etc) across fewer threads, making full use of CPUs. There is no need fo= r parallelism in this model =E2=80=93 at least when it comes to it being= visible to userland. And this is just pie-in-the-sky thinking, because = first, TrueAsync needs to be worked on. It would be more beneficial to e= veryone, to focus on that, and not this. At least right now, it is a was= te of everyone's time. That's my roadmap for FrankenPHP over the coming *years* and they're alm= ost completely unrelated to coroutines and TrueAsync. =E2=80=94 Rob --6cf5f86835084403b0e9b17b6c086945 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
On Fri, Oct = 24, 2025, at 11:43, Edmond Dantes wrote:
>
> So practically speaking, i= t=E2=80=99s not worth designing around this yet. The engine would need m= assive adaptation before userland could safely talk about =E2=80=9Cparal= lelism.=E2=80=9D
>

I agree. Howeve= r, this question was raised. Perhaps there=E2=80=99s a larger
= team of developers working on a new virtual machine for PHP? I don=E2=80= =99t
know anything about that. But if that=E2=80=99s indeed ha= ppening, then the
topic becomes relevant.

=
As for me personally, I don=E2=80=99t see any practical benefit in = introducing
multitasking to PHP. It would require significant = development effort
while offering very little economic value i= n typical PHP use cases.
Still, it=E2=80=99s possible that som= eone plans to build a PHP-Native version
for a wider range of = operating systems =E2=80=94 and in that case, such a
feature m= ight indeed be needed.

--- Ed

The only thing that is relevant to this discussion = (that I know of), is my refactoring of TSRM so that FrankenPHP doesn't n= eed to maintain it's own thread pool of PHP workers. It's only relevant = because it takes away the thread-local bits and makes it possible =E2=80= =93 not that you'd ever want to do it, unless you like segfaults =E2=80=93= to run the engine concurrently across multiple threads. With a decent p= reemptive scheduler (this is distinct from the userland/TrueAsync schedu= ler), you could pack multiple requests in the same thread while waiting = on I/O, and have a different thread pick up work if the I/O finished too= early. This will be entirely transparent to userland and other than TSR= M changes and a few convienent hooks, be handled completely by a Franken= PHP (or even, Swoole) scheduler.

Where this int= ersects with TrueAsync is being able to further pack coroutines (and esp= ecially "native" coroutines like file_get_contents(), PDO, etc) across f= ewer threads, making full use of CPUs. There is no need for parallelism = in this model =E2=80=93 at least when it comes to it being visible to us= erland. And this is just pie-in-the-sky thinking, because first, TrueAsy= nc needs to be worked on. It would be more beneficial to everyone, to fo= cus on that, and not this. At least right now, it is a waste of everyone= 's time.

That's my roadmap for FrankenPHP over = the coming years and they're almost completely unrelated to = coroutines and TrueAsync.

=E2= =80=94 Rob
--6cf5f86835084403b0e9b17b6c086945--