Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:85612 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 97591 invoked from network); 31 Mar 2015 21:47:19 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 31 Mar 2015 21:47:19 -0000 Authentication-Results: pb1.pair.com smtp.mail=php@hristov.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=php@hristov.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain hristov.com from 91.196.125.214 cause and error) X-PHP-List-Original-Sender: php@hristov.com X-Host-Fingerprint: 91.196.125.214 more.superhosting.bg Linux 2.6 Received: from [91.196.125.214] ([91.196.125.214:44974] helo=more.superhosting.bg) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F0/12-19757-4E51B155 for ; Tue, 31 Mar 2015 16:47:18 -0500 Received: from x5f7282c9.dyn.telefonica.de ([95.114.130.201]:48543 helo=[192.168.1.138]) by more.superhosting.bg with esmtpsa (TLSv1:DHE-RSA-AES128-SHA:128) (Exim 4.84) (envelope-from ) id 1Yd409-003IBu-9Y for internals@lists.php.net; Wed, 01 Apr 2015 00:47:13 +0300 Message-ID: <551B15DF.5090105@hristov.com> Date: Wed, 01 Apr 2015 00:47:11 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: internals@lists.php.net References: <551AAB20.6060100@luni.fr> <551AB705.5040001@hristov.com> <551ABCAF.4070008@gmail.com> <551B025C.6010702@hristov.com> <19D697AD-8FC9-4A49-A7B5-3577ED251830@gmail.com> In-Reply-To: <19D697AD-8FC9-4A49-A7B5-3577ED251830@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - more.superhosting.bg X-AntiAbuse: Original Domain - lists.php.net X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - hristov.com X-Get-Message-Sender-Via: more.superhosting.bg: authenticated_id: php@hristov.com X-Source: X-Source-Args: X-Source-Dir: Subject: Re: [PHP-DEV] Re: HTTP/2 and Websocket support in 7.x versions From: php@hristov.com (Andrey Hristov) On 1.04.2015 00:31, Rowan Collins wrote: > On 31 March 2015 21:23:56 GMT+01:00, Andrey Hristov wrote: >> So, if Zend can be optimized to quickly clean the execution >> environment, >> and easily switch between them, we can have a giant leap towards >> concurrent non-blockable PHP. The idea is simple - the Zend environment >> >> should be some structure, and TSRM needs implementation not using TLS, >> in this case. The MySQL Server used to bind a connection to a thread >> but >> since years these are decoupled and with the right plugin you can have >> 100 threads serving many times more connections because thread >> switching >> is an expensive task. This ain't rocket science. > > You make it sound so simple, but the fact that an environment is set up and torn down for each request is fundamental to the whole language, not just a detail of the engine. > > If all you're doing is making that setup and teardown quicker, I don't see how you're getting any closer to asynchronous code. FPM could do all sorts of magic with its memory management, but it wouldn't help someone write a WebSocket server. being able to serve more than 1 request in a thread by not using TLS allows you to lower the number of threads used, significantly. On top of that by adding coroutines which run on a thread pool with fast setup and teardown give you the notion of parallel execution and because data is exchanged with the coroutines only in serialized way, not by sharing it, a bunch of problems related to concurrency won't happen. Add promises to this soup together with non-blocking APIs (this won't happen overnight) and everything fits. > Maybe I'm missing something, but I can't picture how you'd have a meaningfully event-based SAPI that looked just like a single-request one to the user. I don't think that the SAPI needs to change. The SAPI doesn't mandate processes, threads or whatever else primitives. It's a way to (de)initialize module/request. > Regards, > Best, Andrey