Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128792 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 66DC31A00BD for ; Mon, 6 Oct 2025 18:51:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1759776595; bh=QOPGJaqUUX+sffvLmiz0eyBTkhbLcEftqj0iJY3q21Y=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=OUxXbR7SwAzlOmNQsprXW0na3LJGGZmuNn2KyrtzWM52o/N7HCoAg0q8pbi8+2pME tNXF0a5nYe1jHNTfcH28nV7tfVIjFfFJuLJZbFeDK1W7hwJrpGdEBKsdxsXFiBCzXY nl+alUYUFrPCmWOfOjWG9cPs/WlfqVYtrvLSLlmN2Gz6z2KdumYO7kFcXO/+G/uvDx FbmgLnDO80btnOTUvL0iorwtZjFqDsBorpzXOdSjtPL+rVx+LeEjr5HENBHCEycZXr 4CUDZLxUImJ3RYJqXFGIPqH8F6o+kld3/pBHcFN2x3UNvxEcpPQGcYsYQcNJhiDLaY KFCSw/elq5fcw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id B39571804BB for ; Mon, 6 Oct 2025 18:49:52 +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.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from mail-ua1-f48.google.com (mail-ua1-f48.google.com [209.85.222.48]) (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, 6 Oct 2025 18:49:49 +0000 (UTC) Received: by mail-ua1-f48.google.com with SMTP id a1e0cc1a2514c-9231a251c01so2192045241.1 for ; Mon, 06 Oct 2025 11:51:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1759776666; x=1760381466; darn=lists.php.net; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=k2i3JD622zYrEhMG3utHYVcqM7LnwHwo45kVaCeNqWE=; b=kh8ILFV/1R8sWbqasGUOY68SyLc8E9FfcYBY3Q0ElMlYqVy9LVfDv0piIDzpxFa5zb REz5CPMTNU2R4nZ941M9wTJbvw+P6JBUikYAHDuVoe+497InQcGho4W69ylj03ig2kRk CHvpWuAMpECTlWP0lcta6g0v5P3jaJBjggO4X9GN9JY7eH7jzNb295D+CD95uNJH/FwO FZdgnYidu3iFgC2FsTJsxQaGcPvoSVz8wg+In3kw0G3aVa+ymPr10T89ivx7Sl8EoPzo TU7+1AsqMMnKybZSN6zRhiNrCTCHhY98g/QQxTZ0rVcmE9gEnnrmeCOSznipCrDMIMvT fXJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1759776666; x=1760381466; h=content-transfer-encoding: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=k2i3JD622zYrEhMG3utHYVcqM7LnwHwo45kVaCeNqWE=; b=NVOoyO6KgcgiLoZ0RVAtVp3fBsmE1uYu1WiRHWGPO64mEWPsg/XgYEF2a0sE75TVPw VaXtdrNMKWdKwBC+Z9nA8NnK7cORdpYFVZ8kMoTSjTIEuUu3a093icUOvXgVAwS8MRPs NyQYMGFioxTqSz3CTxa1uO91v4eV6wi3m8Oh8ueumNOSr0pfPffUErBlzhn1lmD9pQ+f VQ1HkAaf5kY4mZh8rk3oYZqvDe5w/5HB5YzBjbGvXz6MYtMBsTnq8Jw/C+SnE29asBSu Kw+OUctD1+5oV3o8QTFL9v058mzEbPf3TysoLKbW5evrbseo6qzBJnmnnSAYv6+yoqqY 9DYQ== X-Forwarded-Encrypted: i=1; AJvYcCW1QdSxEqwYXiWK7OyRwslEcDNOIw6LZd1VEFEKXFC6e6tPIoGWH6+qCoQjXR5zGCJbiO2Dih7e1Ac=@lists.php.net X-Gm-Message-State: AOJu0YwZX47D8iEX9tqmgPxYF4AZ+cekk5FuOQ9PPglEOp1Gkca9dcP2 ya5rgXiVX3f9CtaBbsHE1rUMDla0JVxS1Xao840JfdIS0xI1NmxQtpdVaHCOC8wucUbUnlIlZw7 kZQO+/+/H6tPE2aWtIv2Ee+0SJxpC2fuknGzS55w= X-Gm-Gg: ASbGncvthaAv8j6m/iPVA5Ee85Nz5b7lOGzTURVnuJvbXGnMDMAn8+KOkQ+BEw3e3PR LrZ+e2Sy3Pj5+DlP/ZLPdbD2op/Z9GawH+sx79ec665T5UkBhFDh17EX/bznglWmyqRkybcMRlE dSUIKFTPusfZrkyrCfzWFPchO8i8TEdJM6C20iSNO29irmJYhdTRjLAD7SPrUMUzDEU9MomAtuX WehBG68TIM97ivYZl4nNvXVN6WifuI2nVIxs7Gi+g== X-Google-Smtp-Source: AGHT+IF6j3haICJTeQF9xvBtA3rIlI8O6IHrZUmTKrEdn8TpocCdXpTpgHUsT+swjune/MJJFNjuUp28oISNuqoBhc8= X-Received: by 2002:a05:6102:6493:20b0:5d4:1e69:fda0 with SMTP id ada2fe7eead31-5d41e6a0231mr4084960137.1.1759776665746; Mon, 06 Oct 2025 11:51:05 -0700 (PDT) Precedence: list list-help: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 References: <14f591d4-aa1e-49dc-bc20-03cb493dc20c@app.fastmail.com> In-Reply-To: Date: Mon, 6 Oct 2025 21:50:54 +0300 X-Gm-Features: AS18NWCWCsJkjCsF1SrQZYj7vaXhNExZo290wJAxdHfBvhImrF32vZK1RNaMRo4 Message-ID: Subject: Re: [PHP-DEV] PHP True Async RFC Stage 4 To: Deleu Cc: Larry Garfield , php internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable From: edmond.ht@gmail.com (Edmond Dantes) Hi. >> But for the critical parts of a system that requires optimization of th= e execution duration If you want to improve performance, you need to optimize SQL queries, not try to execute them in parallel. This can bring down the entire database (like it did today :) ) There are only a few patterns where multiple asynchronous queries can actually be useful. Hedged Requests for example. Question: how often have you seen this pattern in PHP FPM applications? Probably never :) I know it. Right now, there are only two significant PHP frameworks that are ready for stateful execution. And only one of them supports asynchronous stateful execution. This situation is caused by several reasons, and one of them is whether or not the language itself provides support for it. Why is stateful execution the primary environment for async? Because async applications are servers. And FPM is not a client-server application. It's a plugin for a server. For a very long time, PHP was essentially just a plugin for a web server. And a client-server application differs from a plugin in that it starts up and processes data streams while staying in memory. Such a process has far more use cases for async than a process that is born and dies immediately. This is the distinction I=E2=80=99m referring to. As for the issue with frameworks: a project with several tens of thousands of lines of code was adapted for Swoole in 2=E2=80=933 weeks. It didn=E2=80=99t work perfectly, sometimes it would hang, but to say that it = was really difficult=E2=80=A6 no, it wasn=E2=80=99t. Yes, there is a problem, y= es, there are global states in places. But if the code was written with at least some respect for SOLID principles, this can be solved using the Context pattern. And in reality, there isn=E2=80=99t that much work involve= d, provided the abstractions were written reasonably well. > If you have a report that executes 3 queries and each query averages betw= een 4 to 5 seconds, If an SQL query takes 3...5 seconds to execute, just find another developer= :) Developers of network applications (I=E2=80=99m not talking about PHP) have accumulated a lot of optimization experience over many years of trial and error =E2=80=94 everything has long been known. Swoole, for example, ha= s a huge amount of experience, having essentially made the classic R/W worker architecture a standard in its ecosystem. Of course, you might say that there are simple websites for which FPM is sufficient. But over the last two years, even for simple sites, there=E2=80=99s TypeScript =E2=80=94 and although its ecosystem may be weak= er, the language may be more complex for some people, and its performance slightly worse =E2=80=94 it comes with async, WebSockets, and a single language for both frontend and backend out of the box (a killer feature). And this trend is only going to grow stronger. Commercial development of mid-sized projects is the only niche that cannot be lost. These guys need Event-Driven architecture, telemetry, services. And they ask the question: why choose a language that doesn=E2=80=99t support modern technologies. Async is needed specifically f= or those technologies, not for FPM.