Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:122112 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 24123 invoked from network); 4 Jan 2024 21:30:13 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 4 Jan 2024 21:30:13 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1704403844; bh=mHG5pEvYBQWAWoMkXd/oyAxfRJczsWDoQbb9Qv1Mksk=; h=From:Subject:Date:References:Cc:In-Reply-To:To:From; b=jObiN58n4FJXnnnQqjtu06U6PB09UzA/1rCL+Sq4qohIPS8dkPLDKrTfSuAziQXkB hazCoeoG/40Pe/XngjFMQnPLsqTOeEGhf/PfA5ZOoEv+MjT7ZqxnD8GcGrpg+XD5ct WV6tpy+lRPYAukLcGMiLKDpJG6/RHn+vV2pW42QBkoxgC+/yzrOFTewUhTmGgnbRyR 068dABKplcS78DFvtZVddwdSpjUYobiy4e9QoFszb8nGxuLHOwzuiLhJBRE8wrVYgY OPOviCz5+/+D3F1aA0umh9lMG6KZjWDhh9vZTjupK59zx2qJIR0aLMyzyfpxne7hoi BPoCCvNHRigcQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id AF57C180038 for ; Thu, 4 Jan 2024 13:30:43 -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.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DMARC_MISSING,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-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (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 ; Thu, 4 Jan 2024 13:30:43 -0800 (PST) Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-40d76923ec4so8705395e9.3 for ; Thu, 04 Jan 2024 13:30:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dunglas-fr.20230601.gappssmtp.com; s=20230601; t=1704403810; x=1705008610; darn=lists.php.net; h=to:in-reply-to:cc:references:message-id:date:subject:mime-version :from:content-transfer-encoding:from:to:cc:subject:date:message-id :reply-to; bh=mHG5pEvYBQWAWoMkXd/oyAxfRJczsWDoQbb9Qv1Mksk=; b=ojtPng/LkSZBl62nGxsELFOqMA2bpyyOjedHfCM6RF9cdeen4aMvWch9oWJrCEN+Yl E9sHEhjChGnZ0ez5RSMBlqCvn3lSFc0D3ckuBmWJ7obaDHsFZryvKIbfjgmh9sxPnMiD aZtFcu6HV+LjmoNBwMrUjBb4NPHHiM+jnyeEL87d58M/d6E08Rkxgb4pnjbrNFk+miHP dcgKittT560MP3Z2A5/EejTSCMY7wxSoAKWB4YV0tx4FBqOb9UkiU1BIn7K7EaYmiYx1 /QktaHI6QhgXJEkQULbhVh4gZnI6TUgQy6dmF201649fK7aRKTLcZm0tLX0D8nQWShDS ZxwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704403810; x=1705008610; h=to:in-reply-to:cc:references:message-id:date:subject:mime-version :from:content-transfer-encoding:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mHG5pEvYBQWAWoMkXd/oyAxfRJczsWDoQbb9Qv1Mksk=; b=C0poUPKPEztV6Ql5lre2SOYPAjoZS6KC0wWjte/ORQG5zUvP0B2NffsfGO9WEzT1DK wcO+kbTl02NpFmSu9YC9EUm/UF6i8dhcwIPNwLFE2/kiTogXJZfYvrTM+jslneH9bZt6 shIzKraOA/yAssphq+t8U0/hxmjkQJds93JkwVa184a/Ehn9WaQDqYA90Uj+oQqDQuOL g0fa5XnupGe4Z+dk8aM1Sfz/g+YmTPZCa0LEYOMKzk8wrVHy0jmt6Q2mAjGXO3v+f7Eh 6VcBmifzLeb0+KHnPsslLqJqTbOG+JjeWSVxNrxOGg9eq4paYpRASxVGfcVQAmmmanmE g+ZQ== X-Gm-Message-State: AOJu0YzcrdbFkXDMbtSUUkpXJmCcBVMdx2g9vm65VXyXZX1aNxlz+rFW 5fx+0ZXH90BiI/NgvUz88448lmjIUr4wavUddrubLQlRP7Y= X-Google-Smtp-Source: AGHT+IHrZNDmwfSl80chXAZYOARORikEIhtbKa8aqNbqXUgA2vgHYx4hcPoMjl7gt1HRWqfAiFiwCA== X-Received: by 2002:a05:600c:5487:b0:40d:877d:ca1 with SMTP id iv7-20020a05600c548700b0040d877d0ca1mr632154wmb.54.1704403810089; Thu, 04 Jan 2024 13:30:10 -0800 (PST) Received: from smtpclient.apple ([2a01:cb16:2061:9f06:2113:862b:56f2:28b6]) by smtp.gmail.com with ESMTPSA id k4-20020adfe3c4000000b00336e15fbc85sm125042wrm.82.2024.01.04.13.30.09 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 04 Jan 2024 13:30:09 -0800 (PST) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (1.0) Date: Thu, 4 Jan 2024 22:29:57 +0100 Message-ID: <10C2867D-AF97-4EE5-B079-91383D57CE2A@dunglas.fr> References: <497e4897-c7c8-79e3-f91f-447356e5c9ce@kumbiaphp.com> Cc: internals@lists.php.net In-Reply-To: <497e4897-c7c8-79e3-f91f-447356e5c9ce@kumbiaphp.com> To: Joanhey X-Mailer: iPhone Mail (21C66) Subject: Re: RFC proposal: worker mode primitives for SAPIs From: kevin@dunglas.fr (=?utf-8?Q?K=C3=A9vin_Dunglas?=) > Le 4 janv. 2024 =C3=A0 18:21, Joanhey a =C3=A9crit= : >=20 > =EF=BB=BFHi, >=20 > I like it for start a discussion, than it's necessary. > But we need to see the big picture. >=20 > The CLI-SAPI is the poor brother in PHP (contrary to other languages), but= that is another discussion than I'll try to open later. >=20 > Create a Worker-SAPI? >=20 > First any CLI worker can't access the SAPI. So they don't have any benefit= . > So Amp, React, Revolt, Workerman, Adapterman, Symfony runtime,... can't ac= cess the internal SAPI functions. Each need to recreate in user land PHP cod= e for functions that already exist in PHP sapis. > Kudos, for the RFC RFC1867 from Ilija. But we need to go farther. > It isn't possible use header functions :(, https://github.com/php/php-src/= issues/12304 >=20 >=20 > Later we have SAPIs than use PHP embed (really easy to use :)) or in a sim= ilar way. >=20 > Here we find 2 ways: forks or threads!! > With forks we can use Super-Globals, with threads it's impossible, and for= that they need to encapsulate it in Request/Response objects. >=20 > How we'll join both situations. Here start the discussion. >=20 > Forks: > Frankenphp, RoadRunner, Ngx-php (the fastest PHP runtime),... > Nginx Unit still use a shared nothing approach, but it's really easy to ha= ve both. >=20 > Threads: > Swoole, OpenSwoole, Swoow,... in that situation the super globals are NOT p= ossible. >=20 > Here some frameworks permit use both (forks or threads) depending on the m= aster event loop that we choose. But they need to force all to the threads w= ay to have a unified interface. >=20 > We are talking about the main loop, because inside we can use any thread s= ystem. >=20 > Thanks to all, and to Kevin to start the discussion. >=20 > PD: Actually any new PHP SAPI need to be added to the php-src to have OPCa= che enabled. Nginx Unit and other still use cli-server SAPI to have it. That= need to be changed, so any SAPI can call it, without register. >=20 > Regards > Joan Miquel Thanks for the summary! For the record, FrankenPHP and NGINX Unit use threads, not forks (and recomm= end ZTS PHP builds). And as far as I understand, Swoole etc use a reactor pa= ttern and non-blocking IOs, not threads. Also Symfony Runtime isn=E2=80=99t a= n engine but a library with adapters for FrankenPHP, RoadRunner, Bref etc. The main SAPI using libphp is the embed SAPI, but some non-core SAPIs includ= ing FrankenPHP, NGINX Unit and uWSGI use libphp with their own SAPIs. The co= nfusing part is that you need to enable the embed SAPI through the configure= options to build libphp, even if the embed SAPI itself isn=E2=80=99t used. Best regards,