Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:74948 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 5019 invoked from network); 17 Jun 2014 14:01:11 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Jun 2014 14:01:11 -0000 Authentication-Results: pb1.pair.com smtp.mail=ivan.enderlin@hoa-project.net; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from="\"Ivan Enderlin\"@Hoaivan.enderlin"@hoa-project.net; sender-id=unknown Received-SPF: error (pb1.pair.com: domain hoa-project.net from 95.130.10.56 cause and error) X-PHP-List-Original-Sender: ivan.enderlin@hoa-project.net X-Host-Fingerprint: 95.130.10.56 host1.ip6-networks.net Received: from [95.130.10.56] ([95.130.10.56:43059] helo=host1.ip6-networks.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DC/C0-00242-52A40A35 for ; Tue, 17 Jun 2014 10:01:09 -0400 Received: from host1.ip6-networks.net (localhost [127.0.0.1]) by host1.ip6-networks.net (Postfix) with ESMTP id B155B60B3F for ; Tue, 17 Jun 2014 16:01:05 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=hoa-project.net; h= message-id:date:from:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; s=dkim; bh= HPyWj7aCimBXbFNUz+bXP57NxE/vXORBCN0gg98cslI=; b=gLMlDq94/u5VLCMl 8hPUqkYr8jgAXvzJCjqnPQrBhaposw8eTwRdwge0WYhI7fUWydwZDLHrccwfu2K+ ovxE/ulWPp/wA/zzV8eCokGYLPf/KI/eSoUiSXVQJrSR48BoGx+RY2DYdD2Vp96r jxRd0TdpgtTitkQswvtFFs+yE8g= Received: from Hwhost2.local (3-188.194-178.cust.bluewin.ch [178.194.188.3]) by host1.ip6-networks.net (Postfix) with ESMTPSA id 711C960B11 for ; Tue, 17 Jun 2014 16:01:03 +0200 (CEST) Message-ID: <53A05826.3070000@hoa-project.net> Date: Tue, 17 Jun 2014 16:00:54 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:32.0) Gecko/20100101 Thunderbird/32.0a2 MIME-Version: 1.0 To: internals@lists.php.net References: In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Refactoring our IO multiplexing layer From: "\"Ivan Enderlin\"@Hoaivan.enderlin"@hoa-project.net On 17/06/2014 11:04, Julien Pauli wrote: > Hey :-) Hello :-), > I spent few hours analyzing PHP's IO multiplexing parts. > > IO multiplexing refers to calls to select() / poll() / epoll() or kqueue(). > > Simple notice : everything is sparse everywhere, we don't have an > IOmux layer designed. > > I plan to write an RFC on the subject. > The goal is to centralize IO mux calls in a layer to be used > everywhere. My analyze leads to those points : > > - FPM has something, but not designed to be shared > - User streams use hardcoded select() , with an ugly emulation for poll() > - We have nothing about epoll() or kqueue(), except in FPM > - curl_multi_select() uses hardcoded select() > - php_cli_server uses hardcoded select() > - mysqlnd uses hardcoded select() for its poll() mecanisms > > Python already have a layer, at > http://hg.python.org/cpython/file/abcf17bc5eae/Modules/selectmodule.c > > Apache's APR has a nice layer with adapters, at > https://github.com/apache/apr/blob/trunk/poll/unix/pollset.c > > Still, there exist the excellent libevent http://libevent.org/ What about depending on libuv also https://github.com/joyent/libuv? It would offer nice major features. (Another related link: https://github.com/chobie/php-uv) > > So basically, the first question will be do we need it ? > I would say yes. As we are talking about PHP6 and modernising our API, > it is time I think to implement IO mux correctly and don't use the old > select() everywhere where there is a better implementation (epoll and > kqueue are both faster, and they dont suffer from any FD_SETSIZE > limit) > Also, we didnt talk about things as websockets etc... yet, for PHP6 , > but it is sure that nowadays 2014, IO mux is a must-have. > > Second question will be : do we use, and then link against libevent > (or any other lib that could fit the need) , or do we develop our own > layer, based on the FPM layer which is pretty nicely done (just not > shareable elsewhere at the moment). > > And then, will people be interested by the RFC ? I do. Cheers. -- Ivan Enderlin Developer of Hoa http://hoa-project.net/ PhD. student at DISC/Femto-ST (Vesontio) and INRIA (Cassis) http://disc.univ-fcomte.fr/ and http://www.inria.fr/ Member of HTML and WebApps Working Group of W3C http://w3.org/