Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:108245 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 34909 invoked from network); 25 Jan 2020 22:34:27 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 25 Jan 2020 22:34:27 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id EB55218050B for ; Sat, 25 Jan 2020 12:44:10 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-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,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sat, 25 Jan 2020 12:44:10 -0800 (PST) Received: by mail-wr1-f53.google.com with SMTP id b6so6228498wrq.0 for ; Sat, 25 Jan 2020 12:44:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=OYORcORYIzxzIoN1R+7fi8uBVvsxDRoIN15P7/xQLIQ=; b=Dype2Y/hsKVP0AcOeCKyhvi9yeg3OaBnukU7EKFqXq1ZKWS25skdqvvjAhKVpUmvSy x3ZwhIsOhEFoOKbri+u/LiEe8QQzmiF/1U9nR0PwxItVBWiPVBZYbOHsrXYcrviBFaTH OckZjRur+xRdXvlzFrC1sNsKLwiDv3TNtjRgHiRkpFhirGpkMe7JO0fLbhe/a3t0wMAL 0lFJYrN/QoOUlWadxkHAZ/fJmT0WKcka/3pHfM3Gz045KvjntjXIWzC5d8TzipZXBfGm kQUkJbe2iKg2ifG5Qg+UXkrUzMPGlOfllg8uzxIcaFekCU8xRCt9MpTSKdRB4hgxZ2um 10nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=OYORcORYIzxzIoN1R+7fi8uBVvsxDRoIN15P7/xQLIQ=; b=cOlRwYJxCrh2tXL48Dk09BMvEPMLwBSVqFcvuRzsV8Hzd6yxiqHqy66OpjsM1dMaAX MAWsBScKvf8uFve6SURlICenqOf4FaodJ0fO50bbLodBDywifN2lQmmpTprgAijbz1by S0k1UaF7yIkBaB+95dB1txDMYX/+WYVzeBBnyZC/oP5vFJxduFT4IqSyQe2+Qmb3ZTfj 9fej9ANfrlcWuobFQmb+jsr1fENbbWSknG1KPUbZMlVU9AzPIFNXI3KjG74S5/6GXUZl yCAyzIES0YrYXKI9BqZVXCFO3i+e1d5Cx+lkG9U7jx1trk0P46Q7/L6suhBG8E5e9lUX 4r9w== X-Gm-Message-State: APjAAAWdBu0Q0sMv0cL4BhuRl0gUotzmlJVatnPc4OlxRv/c73m77KHB Sfa1uEQ1pAkzZQ8xQxqKSRIAAObf X-Google-Smtp-Source: APXvYqwlQw2Se2ekYu09t0ZNOfQBHdNyJHjcfzc2DLev6Jr0lUR6K4/n3MT0J0w0Kf2eW5j0vpq5BA== X-Received: by 2002:adf:f6c8:: with SMTP id y8mr11579412wrp.167.1579985047831; Sat, 25 Jan 2020 12:44:07 -0800 (PST) Received: from [192.168.0.14] (cpc84253-brig22-2-0-cust114.3-3.cable.virginm.net. [81.108.141.115]) by smtp.googlemail.com with ESMTPSA id f16sm13344866wrm.65.2020.01.25.12.44.06 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 25 Jan 2020 12:44:07 -0800 (PST) To: PHP internals References: <3ca6d665-1a4f-8f7a-c82a-2e899f2e8df1@gmail.com> Message-ID: <44ba543d-b6eb-888b-9ed5-0f1e9d3b53b9@gmail.com> Date: Sat, 25 Jan 2020 20:44:06 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-GB Subject: Re: [PHP-DEV] Add viable long running execution model to php 8 From: rowan.collins@gmail.com (Rowan Tommins) On 25/01/2020 18:51, Robert Hickman wrote: > Yes that is what I was thinking, for example there is a userspace implementation > 'Swoole' that works in the following way, ReactPHP is similar although I won't > include that example as well. So trying to get concrete: the first "official" component we'd need would be an outer event loop, mapping requests and responses to the parameter and return values of userland callbacks. In principle, not too difficult, although I'm sure there are plenty of devils in the details. > In my mind right now, everything should be shareable within a single process, > as one could do in the Swoole example above, nothing stopping you defining a > global in that script that could cache data in-process. > > NodeJS, Python (wsgi) and others work fine using this model and allow sharing > of data within the same process. Trying to limit it to only some types of things > would be more complex as each type of thing would end up having a different > programmatic interface. I may be wrong, but I think this is where it gets complicated. It's not that we'd want to deliberately have different things have different behaviour between requests, it's just that we've got a bunch of existing stuff built on the assumptions of the current architecture. In a single-threaded event loop, you want as much as possible to be asynchronous, which is why both Swoole and React have a lot of modules for things like network requests, file I/O, databases, and general asynchronous programming. Other things just wouldn't exist if PHP hadn't been modelled as shared nothing from the beginning. Would set_time_limit() still be global, and abort the server after a fixed number of seconds? Or would it configure the event loop somehow? I think there'd need to be at least a roadmap for sorting out those questions in the official distribution before it felt like a properly supported part of the language. Regards, -- Rowan Tommins (né Collins) [IMSoP]