Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:108257 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 55553 invoked from network); 27 Jan 2020 09:10:03 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 27 Jan 2020 09:10:03 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id A2BD91804AC for ; Sun, 26 Jan 2020 23:20:04 -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=-0.7 required=5.0 tests=BAYES_05,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, 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-oi1-f196.google.com (mail-oi1-f196.google.com [209.85.167.196]) (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 ; Sun, 26 Jan 2020 23:20:04 -0800 (PST) Received: by mail-oi1-f196.google.com with SMTP id i1so5738375oie.8 for ; Sun, 26 Jan 2020 23:20:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ODvAGsWmxlI9X+8MJu3OMcQzY8rOr7Rzqh2VHA3LnRo=; b=MsNlS+0XQPDEOgNOXm4kY93g7EB1fqz1/8vpOp7MC9zf80YNhdV5qT4+2Di9dIH7pT lEnKRzN7jk6O1UPb+oUx7bx6P5Q6zVWXCg8zjjJ54VvrJ7qQcS+YDbExs1/Qdbm6eCDH H3T5fg6ld66JepcS6T+JHfXNbYJPnt70xy677iaMTkdnZJ8UysNsPbNDlAdVMDSjX6HZ dxa1wogvL3saFT5Eza7icyiSBqJ9JomA5aYWyprXNHCzhmY4zSSB0X55g3mGxefRbmab 7/FpEfhe+XDSBBJMfMWycD1caLxBFNIUDNCW3YuAG2H0NJI7C9PBcFkbxy9BOeNzHsh8 N5+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ODvAGsWmxlI9X+8MJu3OMcQzY8rOr7Rzqh2VHA3LnRo=; b=rTfhgl9j7h7c62LKCs8LapDgudfzIOwA2PVbo8gE43SRDXrYqk58EBG89Pcvgedg+n r8FyC0Am4E09hC9UxQaZt+1nmJ6b+vZsNlak4z/HiLzth0WedfQCp9lUzMqBSbdWwzCh oFegcaxpvQqlTH9oOQYusXpT2bOoHa+M1Pw3zUvSpxOmFnEkm45NdUjjVPELNggApEgW HlTJKSUUAcAAyWyLQpZuh5p9hE+5WqIVKf0lMvuCHx8g82Kh/fGSlVuR33ElW6gpPtBs uKTY2F438/vvjPTNctRv36BfN0q19zaVlo5MfK3zkaPA9qMCfLHJ06N7//HDeIkh+rsl dP9A== X-Gm-Message-State: APjAAAVaCH3EEEHKedpu9LlukqzMt6B52GjK6febtGFH/1kzcSDFDsCE D+cm3GLYrZdDiFMkmvlJ/DaUvPr0idCEv3svzfw= X-Google-Smtp-Source: APXvYqxviQy7W/j22ln7kdwlIMPzaGGxYMS2JEny74EsDL2xKlXk06w7SmLmwd/A1NTWSdUhhHgHQTXWyctRyYeJ01A= X-Received: by 2002:aca:503:: with SMTP id 3mr6404310oif.24.1580109600491; Sun, 26 Jan 2020 23:20:00 -0800 (PST) MIME-Version: 1.0 References: <3ca6d665-1a4f-8f7a-c82a-2e899f2e8df1@gmail.com> <44ba543d-b6eb-888b-9ed5-0f1e9d3b53b9@gmail.com> <8E382251-AE41-4BD9-A5F8-135D11B9E10D@newclarity.net> <98A11C8F-6B51-4774-A2F6-6B6C7311180B@newclarity.net> In-Reply-To: <98A11C8F-6B51-4774-A2F6-6B6C7311180B@newclarity.net> Date: Mon, 27 Jan 2020 07:19:49 +0000 Message-ID: To: Mike Schinkel Cc: Rowan Tommins , PHP internals Content-Type: multipart/alternative; boundary="000000000000718cb3059d19ef2f" Subject: Re: [PHP-DEV] Add viable long running execution model to php 8 From: robehickman@gmail.com (Robert Hickman) --000000000000718cb3059d19ef2f Content-Type: text/plain; charset="UTF-8" > > I'm not sure that would work well for Web Sockets, because it still > relies on the traditional request-response cycle, but I've never really > used them, so don't know what kind of architectural patterns make sense for > them. > > Considering the Swoole PHP extension (https://www.swoole.co.uk) the > long-running process would take the place of its functionality and new apis > to communicate with a long running process could allow communication that > resulted in regular requests being able to send messages via the web socket > server, and read queued messages from the web socket server. > > You won't be able to process notifications to clients via > request-response, but where that is needed it would be done by the > long-running process. So the request-response might "register" a > notification listener to the long-running process, for example. > A web socket is just a way of re-using the tcp connection from a http request and holding it open for bidirectional communication. Due to this you can make assumptions about performance charicteristics from other long running socket server approaches. From what i understand, the main problem with using fork or a thread pool for handling sockets syncroniously is overhead caused by the switching between userspace and os kernel space, as well as high memory overhead. Using fork would have the same behaviour as something like apache prefork. Handling a long running connection entails a process per connection, which could mean an awful lot of processes. Pretty much everything seems to be switching to async io based on some event loop, as it allows a single process to handle requests from a large number of connections, and long tunning but sparsely used connections don't require holding processes open that are mostly doing nothing. Based on what i see from the direction things are going in other languages, just 'getting with the times' and switching to an event based model probably makes the most sense. Anyway, i think PHP really needs to be able to handle web sockets in core. --000000000000718cb3059d19ef2f--