Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:74942 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 90041 invoked from network); 17 Jun 2014 11:49:49 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Jun 2014 11:49:49 -0000 Authentication-Results: pb1.pair.com smtp.mail=julienpauli@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=julienpauli@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.171 as permitted sender) X-PHP-List-Original-Sender: julienpauli@gmail.com X-Host-Fingerprint: 209.85.220.171 mail-vc0-f171.google.com Received: from [209.85.220.171] ([209.85.220.171:61427] helo=mail-vc0-f171.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 95/60-21963-C5B20A35 for ; Tue, 17 Jun 2014 07:49:49 -0400 Received: by mail-vc0-f171.google.com with SMTP id id10so6396398vcb.30 for ; Tue, 17 Jun 2014 04:49:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=5xsdRF4goBjOhAj527eVRUjbjWS1LwWuuFfHJ4rRW+w=; b=oFoMrJoZ9AtNWt2Q5mAYjKjh5Szpug3uY91iI0loacscZq/7KnqAfhJ8PIwfwx1x1d Yl7p5Lesx2eMY8QX6SMbIjMK8tr6ejLWoRINbIXRNeGx9vNgttpL77IJWfpnoo2QsY9A yyh6eeH5GwuPc2AP+pc1ravA6doYxm7JXiSOT1Rad+ZpbTN/d0TQw9MYC+UD7PBkPNVq U4eCJmbfXI0wa5qGF70COqUj03p9onIhIMUnMH7TUk2ixBRr1HajIfi+SulUso1dgFKk ePNJ8s0Y8Bwei6O6wP1ehMoDaWyhSmBq7Pywe33nh6JDwnrT/YVQHmn2y0d4WIBXZuKG ckYw== X-Received: by 10.52.117.209 with SMTP id kg17mr8672703vdb.28.1403005786039; Tue, 17 Jun 2014 04:49:46 -0700 (PDT) MIME-Version: 1.0 Sender: julienpauli@gmail.com Received: by 10.220.81.68 with HTTP; Tue, 17 Jun 2014 04:49:05 -0700 (PDT) In-Reply-To: References: <20140617110758.GD24253@methuselah> Date: Tue, 17 Jun 2014 13:49:05 +0200 X-Google-Sender-Auth: jgoqVP8ti6gLEcXKnvwUp3k-FR8 Message-ID: To: Chris Wright Cc: Martin Pelikan , PHP Internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] Refactoring our IO multiplexing layer From: jpauli@php.net (Julien Pauli) On Tue, Jun 17, 2014 at 1:33 PM, Chris Wright wrote: > On 17 June 2014 12:05, Julien Pauli wrote: >> CCing internals >> >> On Tue, Jun 17, 2014 at 1:07 PM, Martin Pelikan >> wrote: >>>> Still, there exist the excellent libevent http://libevent.org/ >>> >>> Speaking as only an observer to PHP development, I have been reinventing >>> this particular wheel in my project (SSH client to thousands of machines >>> to replace the painfully slow python's paramiko, as seen in my thesis at >>> http://qviz.storkhole.cz/). >>> >>> My ~3 months of experience: >>> >>> The questions you want to ask are: >>> - "what's wrong with libevent" >>> - "how would you do it differently" >>> - "why does PHP need it differently" >>> >>> I strongly suggest not creating yet another way of doing I/O multiplexing. >>> nginx looks pretty neat and shows just how much work is needed to get things >>> right on all platforms. PHP developers have better things to do than this. >>> >>> http://trac.nginx.org/nginx/browser/nginx/src#event/modules >>> >>> If someone would say to me "learn and then read libevent" right away, my >>> backend would be finished now. Seriously. Go and have a look, it is >>> likely to save a lot of your time. >> >> Yes, libevent seems to be the API we need. >> Regading Nginx, I'm not sure we need file AIO, for PHP, network AIO >> could be enough to implement. Still, our FPM IO multiplexing layer is >> stable now. > > File AIO would still be nice to have though, it's common to pipe data > between a network fd and a file fd - when the file system blocks, that > can be a sizeable performance hit. Libuv seems nice as well, yes. Not sure about its licencing compatibility with us though. > > I may get shot for suggesting this, but libuv provides all the things > libevent provides, plus filesystem support (also, the built-in async > DNS resolution is a nice bonus). Why not use this part as well in our DNS resolutions, could be nice. > >> The problem of binding a lib is that you add one more dependency, you >> have to check for licence compatibility, and check for the dependency >> when building. Not talking about bugs in the lib impacting our >> codebase. This is a tradeoff. > > While this is very valid, in this particular case I believe it would > be worth it, due to the insane complexity of reinventing this > particular wheel. +1 ! > > I believe Daniel Lowrey and Joe Watkins were bouncing some ideas > around on exactly this subject off-list a few weeks ago, I'm not sure > whether they have anything tangible yet. So, waiting for them to jump into the topic :-) Julien