Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:126416 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 qa.php.net (Postfix) with ESMTPS id 8A5491A00BC for ; Fri, 14 Feb 2025 15:18:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1739546131; bh=/xz+VEPA6P3Z5+IzXMi7tQlV7aEE0HHQEZD/kDDxZGY=; h=References:In-Reply-To:From:Date:Subject:To:From; b=XU7+d0o2WoHbqn0EqUvGNCLkUmHIWlHEokh/oABXs4wwST+XOJFq8eyo5mDg4HazU YCe5+AhCpwKTYmAYlydg8043GznNTjCAMjqCha0uJxKYnnynjS+EVVkBikaoSzK1kJ Wu8oCZs3fQTN75oW7YOhdN59oFZ42OQTWaMbWbcL+NgfZ/+yymmM7N+dalFr2jC3+F 7CmGxWfdURqYgiOQ320ReU6ThsP6jheq0u8s257MJZL5BfPTDsRp6mChtV4EfJq4MU HjBi2d3NFzF897tufoUBeLI2tByVHge7JOabKARQh+4Deu4HA5o6uHHJK5hu1OCeG4 6ron5ymQ5Orug== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id E134918006C for ; Fri, 14 Feb 2025 15:15:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_50,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-yb1-f177.google.com (mail-yb1-f177.google.com [209.85.219.177]) (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, 14 Feb 2025 15:15:30 +0000 (UTC) Received: by mail-yb1-f177.google.com with SMTP id 3f1490d57ef6-e5b296611d1so2783174276.1 for ; Fri, 14 Feb 2025 07:18:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1739546292; x=1740151092; darn=lists.php.net; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=/7CldmfDskN1lVKeWQJGE5zUxhKIRcQbzff+KhAoobk=; b=hoxXJxVLEiwBOMAqHiJYEA5p9wj7wBbEyH7nczOpFXhNNOnmwAp36Z/HzTFEnw4czl 0f/TZtFPDskaXUUKZ4VVvmM8HkgnvHUa8+BiQLxE9C/4ZVYeD4juR4L9PkCM0KTFvpac +9c6Il7xwUhCGk38zGiQ/x/bakJ/15vT6MF3ne7J1tvGjpinIBM32tjq9gwmVjkfuB1Q 6fmz2EVwKBD0RcSlqf1k4751aiYEaNhnAd2jB74qM8XsSCv1Y5e9rsSLxMrhJcyFMFGz XQJsEMHpn7S5mmI4ZdHeasgSCNXPQskzwop84KBQMyAdP+URepWKrQJ4/gYttzWGjlen W5tA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739546292; x=1740151092; h=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=/7CldmfDskN1lVKeWQJGE5zUxhKIRcQbzff+KhAoobk=; b=r1Em83mvC9S0XW0ZHVoli492AmZ1GvoD0J2aAcsz2Z0ckDaUQapafV0vK3r0QL8uLM jMa7u4p1uHZTTACJASwIXema2gHi4kXbLI01OcqmzMT3P8R4QkxN90QtddUvLl5uwWJY Q30y1E/bB7E5TxRdVSLsoK270t0dXpeVEfBEYwJ1UGNmqBvGR6L90++LJFuD+DttKVYp m26tKQ0kFkswZenh+BF88xzfWYRbU3meJeO1iYnCoG3dbY0ALHYbypqAEDUid4hB/kE+ nkZApFbvmduPKOU9/fiyvomZwXs5KC1FCZJ70TEu6G4QrSnL0FQI72uj+1U2qZOOABuW NmYg== X-Gm-Message-State: AOJu0YylkK4//XW0OY+3OuldvIkDrZPs7Xxu2ixJuhl0V6IBb1IqfvDl AEkajfWPiqVgsCeDZ0OYucbCsCgeMxCivokXTtPVlj34ZJkgYticW47lOzgW0m5cSjrl9WsGoBb tdoHvEy2KWjwRhNHNRFffHA7hwpuKTIuB X-Gm-Gg: ASbGncvZYzVJwJWt8OodPE0JU1j4kNW15PSVaxnc5a0pBQIVR3h676dPGM883oxnG6W bGwzssqvD8iincapJuy0mUUmXfoII4iEELOaUkWKIE2r/TEZJuCFaL4YSBBt8K3IY3bdWBOJY X-Google-Smtp-Source: AGHT+IHELtB5m8+EQuhoKMEYIzTKEeWDnDs52FL9TrqrqwEmyDmu6TP7Ia9Q+Wg06UWHuqQSD43T9sWWK2UXnRsaFis= X-Received: by 2002:a05:6902:920:b0:e5b:4651:b5c6 with SMTP id 3f1490d57ef6-e5daac9608bmr7098346276.23.1739546292321; Fri, 14 Feb 2025 07:18:12 -0800 (PST) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 References: In-Reply-To: Date: Fri, 14 Feb 2025 17:18:00 +0200 X-Gm-Features: AWEUYZmuP6cGquJfEcWrXsgiDUL0BzxzdyLIPlfVjZom44NbzAmMU6uAeCFI1Pw Message-ID: Subject: Re: [PHP-DEV] PHP True Async To: internals@lists.php.net Content-Type: multipart/alternative; boundary="000000000000d30457062e1bae6c" From: edmond.ht@gmail.com (Edmond Dantes) --000000000000d30457062e1bae6c Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable > Yeah we are actually planning better API for this supporting epoll and kqueu which is long over due. There are other use cases for this so hopefully it will get prioritised soon. Oh, it would be absolutely great if PHP used a better abstraction for I/O waiting! > You could still achieve this in extensions. But if you really wanted to have some main part, then it should rather go to main/ like streams and other similar stuff. Of course, this will need some thought. I have got some additional feedback from our discussion that we just had > with the PHP foundation devs. *It was that it looks like an async/await > implementation with fiber switching which is something that was explicitl= y > decided not to be done in fibers RFC* - https://wiki.php.net/rfc/fibers (= read > FAQ). The reasoning was that this should be done in user space. So you > should properly describe in the RFC what this offers compare to user spac= e > variants (revolt/react/amp). There were also some concerns that it would > makes things harder to debug in internal implementation so this should be > also addressed in the RFC. It should be noted that Fibers RFC did not > preclude introduction of such extensions to the core but you will likely > need describe it in the RFC and show that there are good reasons to inclu= de. Unfortunately, I don=E2=80=99t know much about what happened during the ado= ption of Fibers, but I remember that the situation was not ideal. I don=E2=80=99t kn= ow why that decision was made. For me, as a developer, the ultimate criterion is the code itself. If a solution makes the code better, simpler, and reduces the number of lines, then it=E2=80=99s a good solution. If a solution forces developers to repea= tedly write the same boilerplate code, including entire MySQL/PostgreSQL drivers, then I can=E2=80=99t consider it a rational decision from a development perspective=E2=80=94though, of course, there could be other reasons, such a= s financial constraints or lack of resources. Or look at Swoole=E2=80=94it ha= s to override dozens of PHP functions. Even worse, it recently started literally copying entire extensions just for a few lines of code... This does not look like a "good solution." AMPHP and Revolt are talented projects, but they are not part of the language itself. This means that PHP extensions cannot call user-mode code and rely on it as a standard, unlike how Rust extensions do. Of course, from C, you can call any user-mode function, but that doesn't seem like the right approach. Especially since PHP is a high-level language, which imposes a responsibility for consistency in its paradigm. Regarding debugging=E2=80=94over the past three years, there have been no d= ebugging issues with AMPHP. Consequently, there shouldn=E2=80=99t be any, since this= project does not modify the Fiber mechanism itself. It only extends it to make the tool more complete and fully functional. And this is precisely the main reason why I=E2=80=99m writing these lines. = As a PHP developer, I see that the language is not truly complete when it comes to concurrent programming, and I am genuinely surprised that this has not been addressed yet. How did this happen? Have a nice day! Ed. --000000000000d30457062e1bae6c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
>=C2=A0 Yeah we are actually planning better API for this supporting epoll and kque= u which is long over due. There are other use cases for this so hopefully i= t will get prioritised soon.
=C2=A0 Oh, it would be absolutely great if= PHP used a better abstraction for I/O waiting!

&g= t; You could still achieve this in extensions. But if you really wanted to = have some main part, then it should rather go to main/ like streams and oth= er similar stuff.=C2=A0
=C2=A0 Of course, this will need some tho= ught.

=C2=A0 I have got some additional feedback from our discussion that we jus= t had with the PHP foundation devs. It was that it looks like an async/a= wait implementation with fiber switching which is something that was explic= itly decided not to be done in fibers RFC -=C2=A0https://wiki.php.net/rfc/fibers= =C2=A0(read FAQ). The reasoning was that this should be done in user space.= So you should properly describe in the RFC what this offers compare to use= r space variants (revolt/react/amp). There were also some concerns that it = would makes things harder to debug in internal implementation so this shoul= d be also addressed in the RFC. It should be noted that Fibers RFC did not = preclude introduction of such extensions to the core but you will likely ne= ed describe it in the RFC and show that there are good reasons to include.<= /blockquote>

Unfortunately, I don=E2=80=99t know much= about what happened during the adoption of Fibers, but I remember that the= situation was not ideal. I don=E2=80=99t know why that decision was made.<= /p>

For me, as a developer, the ultimate criterion is the code itself. If= a solution makes the code better, simpler, and reduces the number of lines= , then it=E2=80=99s a good solution. If a solution forces developers to rep= eatedly write the same boilerplate code, including entire MySQL/PostgreSQL = drivers, then I can=E2=80=99t consider it a rational decision from a develo= pment perspective=E2=80=94though, of course, there could be other reasons, = such as financial constraints or lack of resources. Or look at Swoole=E2=80= =94it has to override dozens of PHP functions. Even worse, it recently star= ted literally copying entire extensions just for a few lines of code...=C2= =A0 This does not look like a "good solution."

AMPHP and Revolt are talented projects, but they are not part of the= language itself. This means that PHP extensions cannot call user-mode code= and rely on it as a standard, unlike how Rust extensions do. Of course, fr= om C, you can call any user-mode function, but that doesn't seem like t= he right approach. Especially since PHP is a high-level language, which imp= oses a responsibility for consistency in its paradigm.

Regarding debu= gging=E2=80=94over the past three years, there have been no debugging issue= s with AMPHP. Consequently, there shouldn=E2=80=99t be any, since this proj= ect does not modify the Fiber mechanism itself. It only extends it to make = the tool more complete and fully functional.

And this is precisely th= e main reason why I=E2=80=99m writing these lines. As a PHP developer, I se= e that the language is not truly complete when it comes to concurrent progr= amming, and I am genuinely surprised that this has not been addressed yet. = How did this happen?

Have a nice day!

Ed.


--000000000000d30457062e1bae6c--