Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:122075 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 4728 invoked from network); 31 Dec 2023 01:20:09 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 31 Dec 2023 01:20:09 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1703985638; bh=scd+JJVBRpsap/R0TXVu2VbENhnfqIPTc6/qQycMcmY=; h=Date:From:To:Subject:In-Reply-To:References:From; b=f4o7z4CQHpeJxX7dv0w9/DEutuopj2UQGyENoSKlvXAkrhF3AxNfj2VVdKegeNAN7 S4aPthJAxLz1gNTQE4P7YYMUS7JIOc6qP6i68R3tqhW7tqDMaOjsB3D/i+qqdB33l1 i9Waj4na/u3w55WB1gZY1euv401dhO2KkV9a5mPnrqz8cO2wr9H4tRlgvKBObfy8UF 5v1Lxa9JD3gqbSbAo0iJ2gYvWT0rUbbYvwiOB4I/VAd5lU2ZEs7Ny3ZKiWw16lwaqN 84XDQIoVPLrz6rtz3Ro+o1bFymqj+ynPdzbpJ7I/kQgcSOK7V8FUZnqt7O4JjYBlAr 4N8/XvyJOiqgA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 5DD6F180038 for ; Sat, 30 Dec 2023 17:20:37 -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=-1.7 required=5.0 tests=BAYES_05,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.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) (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 ; Sat, 30 Dec 2023 17:20:36 -0800 (PST) Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-40d60c49ee7so29477775e9.0 for ; Sat, 30 Dec 2023 17:20:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703985607; x=1704590407; darn=lists.php.net; h=content-transfer-encoding:mime-version:message-id:references :in-reply-to:user-agent:subject:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=0NWtOVRWgzn5pPk0RduHLO/3bKmZQwzGL+Le9OrvjCA=; b=L71xtNNHcbiKYYOcEhr377uT2neb9PRSS0Pl1/PqzzFORDa17kTDX+s+E0PKDW/PMY 6AHh+YtTTSgWozgT4UojQxGVB+9BVJ3SXjoZWKSRhyKerfwn7GyKJQrYZCpMARgvoHfE +zZk8BRBG/jla2A4rpohzvZUzsaxLbiJ4gJgoV5WlU2C7GRLG0hYvUL27dL7sqrpvHFu gcqtlnsYELdtuuR8wO//qFLL4E4qAImw3qTRJqjp5hBgREARX3OajzQUCOV/slz5fkbV j7Poz/ZaGk58zZZpIqmbhfotB/UEZZrIvIqKyUiYtdG8LWjv91POX8bjQyyLb7ANVydu XIJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703985607; x=1704590407; h=content-transfer-encoding:mime-version:message-id:references :in-reply-to:user-agent:subject:to:from:date:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=0NWtOVRWgzn5pPk0RduHLO/3bKmZQwzGL+Le9OrvjCA=; b=chTroQrvQ54Otemwn6ZDPf1sqwlCenQF5k0srWPHXLsmXCVjmw8o+MpJFb33F9xhIL G13PQWx/leyeW3BevQrTiw7d3uTLlxsi21o44Fbc3NipvLdihtI2aO2+6pVyoWwYLIQN CgfgycFqiIdGIFaORJgAte0HuczyG0p3cz+0pR3EDYfEvNoj5+zzkxAi294GR/oex3TA ukTRvtoK+z/WJh07DHX9Ab91KdFpbtg4XAAz9vDSrFubE8oMItzueVpmX2Napdfmeq6/ Q3CUIIMwHNLA+bfSwloRLEWr4joKU1wVbSQrQ18/5k88mwXztheSNmXi9NvJuaRXG/qt jQgQ== X-Gm-Message-State: AOJu0YxWSBPcJ4P0TGYP8wmQfs/7QaIVOHFawkMiiO5v+x3NBgZRtLtq Ekdshcx4+aNC7qPQ+r61NOA/q7xkT8k= X-Google-Smtp-Source: AGHT+IFhqK8KyKlbiqxggrXR3N0+5DYOSNoFEttoLOeSpK++2Jd2xhkOTdP3Gcb772gf+bgg/l3ihg== X-Received: by 2002:a05:600c:458f:b0:40d:5cea:893c with SMTP id r15-20020a05600c458f00b0040d5cea893cmr3458615wmo.186.1703985606955; Sat, 30 Dec 2023 17:20:06 -0800 (PST) Received: from [127.0.0.1] (cpc83311-brig21-2-0-cust191.3-3.cable.virginm.net. [86.20.40.192]) by smtp.gmail.com with ESMTPSA id n15-20020a5d400f000000b0033662fb321esm22568702wrp.33.2023.12.30.17.20.05 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 30 Dec 2023 17:20:06 -0800 (PST) Date: Sun, 31 Dec 2023 01:20:01 +0000 To: php internals User-Agent: K-9 Mail for Android In-Reply-To: <8fb6672c-06e9-4f74-b2f2-cd1a265c75a5@app.fastmail.com> References: <5060b986-2e5a-46e4-9c83-763e5b155e83@gmail.com> <6f7815b9-80cc-4e08-819a-49dca090116f@gmail.com> <7F63D301-1A46-49AA-9140-F64543E902C5@gmail.com> <8fb6672c-06e9-4f74-b2f2-cd1a265c75a5@app.fastmail.com> Message-ID: <96C28696-7C58-4018-84EB-69CF4189649B@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 30 December 2023 19:48:39 GMT, Larry Garfield = wrote: >The Franken-model is closer to how PHP-FPM works today, which means that = is easier to port existing code to, especially existing code that has lots = of globals or hidden globals=2E (Eg, Laravel=2E) That may or may not make= it the better model overall, I don't know, but it's the more-similar model= =2E That's why I said earlier that it provides better backwards compatibility = - existing code which directly uses PHP's current global state can more eas= ily be run in a worker which populates that global state=2E However, the benefit is marginal, for two reasons=2E Firstly, because in p= ractice a lot of applications avoid touching the global state outside of so= me request bootstrapping code anyway=2E The FrankenPHP example code and Lar= avel Octane both demonstrate this=2E Secondly, because in an environment that handles a single request at a tim= e, the reverse is also possible: if the server passes request information d= irectly to a callback, that callback can populate the superglobals as appro= priate=2E The only caveat I can think of is input streams, since userland c= ode can't reset and populate php://input, or repoint STDOUT=2E On the other hand, as soon as you have any form of concurrency, the two mo= dels are not interchangeable - it would make no sense for an asynchronous c= allback to read from or write to global state=2E And that's what I meant about FrankenPHP's API having poor forward compati= bility - if you standardise on an API that populates global state, you clos= e off any possibility of using that API in a concurrent environment=2E If y= ou instead standardise on callbacks which hold request and response informa= tion in their own scope, you don't close anything off=2E If anything, calling this "forwards compatibility" is overly generous: the= OP gave Swoole as an example of an existing worker environment, but I can'= t see any way that Swoole could implement an API that communicated request = and response information via global state=2E Regards, --=20 Rowan Tommins [IMSoP]