Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:122119 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 72259 invoked from network); 5 Jan 2024 10:59:15 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 5 Jan 2024 10:59:15 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1704452387; bh=kaJrCuvm9SsG+GTxSYGyiLfnUiBAwTz60kIvKDtyfE0=; h=Date:From:CC:Subject:In-Reply-To:References:From; b=O1j9n70JUX28Zxhf8xEIEsizgaVk2PVPegqTjnSIYiZyAYSutpIX4xVtkP0+hEBgp WxF89Ojo+BoMz8qrv/e4B5tK26fxY2oCM797ENNZO5pN0SeRLXyNgM37Jl6vMJPCSk eKU57Jd7uWdBk7n5lc2z7V7wWk7njyCj+qv8FbrxcEdRPYj5wpFREZATz5Qu4nl95E Gze4PTmEJomfkLhKhEx+vARjusvCC6zVDImXBkrZRP+rJ8YLc/Lt+G1GIBOJrCBNaA yd/z05oN2aFPFIDwPxASVQCmv2kK3enA94Zcu9AWSLPRffqKe0871PQp40QcPXR1JQ k0yAYm9GseeYQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id DD10E180069 for ; Fri, 5 Jan 2024 02:59:46 -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, MISSING_HEADERS,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-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (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, 5 Jan 2024 02:59:46 -0800 (PST) Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-40d5d898162so10795055e9.3 for ; Fri, 05 Jan 2024 02:59:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704452353; x=1705057153; darn=lists.php.net; h=content-transfer-encoding:mime-version:message-id:references :in-reply-to:user-agent:subject:cc:from:date:from:to:cc:subject:date :message-id:reply-to; bh=kaJrCuvm9SsG+GTxSYGyiLfnUiBAwTz60kIvKDtyfE0=; b=QG4FWVkSKJdviXDUvGunLYSqSqWfp0fKGDUYFS16ShY/HwNGKHoiniFHcGLkxXmKWQ A/pxROTEwXrTJdp9Y//kdCwp3ESavcSLNPZB6THdro5mHDYWluFBRgDu+u3g/xEmMSJP 0WP4z9LAMHvv3nlzt4QRzBqypWuNOOCzxoyYh5IT7WJ3rSehzokQtIt8iw/bQVIzX4AT shyPHHMjBFUaqCxfqha/rBj4wQGCRRGETNmurSKOxZu6ihhqqxAq5V4MsAAYtGv7XZSF ZXb/6Zhla2AKRcaOEilfjaD2c37VBawO3x2wOdH2AEfQqwhGeY9RYrcDg06sLGsLMsVR 2kCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704452353; x=1705057153; h=content-transfer-encoding:mime-version:message-id:references :in-reply-to:user-agent:subject:cc:from:date:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=kaJrCuvm9SsG+GTxSYGyiLfnUiBAwTz60kIvKDtyfE0=; b=saD7zYpS4soFYZmi6+/RYGMiZhdws2aB+Eecmx0e0fBl5ujC5GX3/qIudcEO7KRZiI +LrlQgLcUbiqvj761imL0p2M/+wdjI2bWVkLHORklKWe7v2172okRtb8ZHTd+vGEGWY9 /5CAqFszKAImGlihgckTaqTaoyo0tsraXUl9KFPU49TPTQ9fc+CcbOk96sdQWxF62qBb Dp1ET0Fqj7Nqkl08vr70YoPz1VA8O58tNebhu2uu+yWLSXXu5l345nfiPV7usxZR5ko6 IHsdjkWpU+b6V2P6xTetArHE0wv1bDyvf2XuETYrXeU9qRCTb5oyN7hB+oSjyxxFZu6y 1jlA== X-Gm-Message-State: AOJu0YywJ3sTTYCTwfvkn0AVIaumFP3cdZUts9OABFMnTnFb4/vFYNsx 8ONyJFODtcaMKagh92nVQteSEuKf01o= X-Google-Smtp-Source: AGHT+IGssrvaQbbgzSdTUJbIKzF7wne5sgpm4zfNDBOGiT5JUdHp5DIEN6+9zdi2W4dJvZsvZ+7Lrg== X-Received: by 2002:a05:600c:1c9f:b0:40c:78c:f2b0 with SMTP id k31-20020a05600c1c9f00b0040c078cf2b0mr1150839wms.2.1704452352878; Fri, 05 Jan 2024 02:59:12 -0800 (PST) Received: from [127.0.0.1] ([217.38.59.169]) by smtp.gmail.com with ESMTPSA id r21-20020a05600c35d500b0040d91fa270fsm1216055wmq.36.2024.01.05.02.59.11 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 05 Jan 2024 02:59:12 -0800 (PST) Date: Fri, 05 Jan 2024 10:59:07 +0000 CC: internals@lists.php.net User-Agent: K-9 Mail for Android In-Reply-To: References: <3828a559-5dae-44d1-96ce-dff1a8b07c18@gmail.com> Message-ID: <99C434B3-3953-4E90-8DEA-94237332219D@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] RFC proposal: worker mode primitives for SAPIs From: rowan.collins@gmail.com (Rowan Tommins) On 5 January 2024 09:02:05 GMT, Robert Landers wrote: > I don't think they are fundamentally incompatible=2E If we look at >FrankenPHP's implementation, you pass a callback that gets called when >there is a request=2E No, you pass a callback which is called exactly once, for the next request= =2E You have to implement your own loop if you want to handle multiple requ= ests, which obviously isn't how it would work with an async event loop=2E That was one of my suggested changes: move the loop into C, so that the AP= I was "callback called for each request"=2E This actually *adds* flexibilit= y on the server end, to decide how often to call that callback, do so async= hronously, etc=2E > Globals is how this works (atm) It's how it works for native SAPIs=2E It's not, as far as I know, how any = worker system other than FrankenPHP has implemented its API=2E Every other = implementation I've seen, whether async or not, passes in some form of requ= est data to the callback, with the exception of RoadRunner, which gives the= data as a return value from a "get next request" function=2E So, the second suggested change is to standardise on the most common patte= rn of passing parameters to a callback, rather than the unusual one of popu= lating and clearing superglobals=2E As a bonus, this pattern works with bot= h non-async and async workers=2E > changing the signature of the callback is generally backwards compatible This is true in the narrow sense that it won't cause any fatal errors=2E B= ut if you write your application assuming that it will run in an environmen= t where globals are populated for you, it will not run in an environment wh= ich no longer populates those globals=2E >Changing the underlying implementation in php-src when there are >native fibers/event loops probably won't even change anything (since >that was exactly how they were designed)=2E Sounds great! So we don't need to wait to put that implementation in place= then=2E >But holding up the entire conversation =2E=2E=2E There is no reason whatsoever to hold anything up=2E The suggestion is not= "don't implement any worker API until we have an async implementation", it= 's "a worker API sounds great, let's implement one that looks like this"=2E Yes, it might take slightly longer to define some new array structures, bu= t we're talking about a few hours work to give us a much more flexible syst= em, not weeks of complex engineering=2E If the proposal is "copy some code from FrankenPHP into php-src, which nob= ody else will want to use", it's pointless; if it's "standardise an API wit= h some enabling code", then *of course* we want to spend a bit of time desi= gning that API=2E Regards, --=20 Rowan Tommins [IMSoP]