Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:74941 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 88121 invoked from network); 17 Jun 2014 11:34:01 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Jun 2014 11:34:01 -0000 Authentication-Results: pb1.pair.com smtp.mail=are.you.winning@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=are.you.winning@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.172 as permitted sender) X-PHP-List-Original-Sender: are.you.winning@gmail.com X-Host-Fingerprint: 209.85.216.172 mail-qc0-f172.google.com Received: from [209.85.216.172] ([209.85.216.172:47599] helo=mail-qc0-f172.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 85/00-21963-9A720A35 for ; Tue, 17 Jun 2014 07:34:01 -0400 Received: by mail-qc0-f172.google.com with SMTP id o8so9713561qcw.17 for ; Tue, 17 Jun 2014 04:33:58 -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:date:message-id:subject :from:to:cc:content-type; bh=7NU4FQP9mpDELN8vWlx3rYm2PzJsn7bBQVlmP9rSbI8=; b=NcUs/nv2olskrpvMKOktU7Tann7AnZDJ6d1+PNAPIMttTA8DEJnGNo72IGbYjwlFxm act+kupk8/lxb7/2wAT/AFO6ua/0gxhFdWF1WfWk60nbDAvAKeiK17OjWd9otkafm1J+ FeOd0XmaTm2rFimISiyLa2TR4eW/jLl2p1Nb3CkUbH/7goPkU+taaDkZClq311J2EVPC Z4lgn65NVJQuW7OhK2W82wmUKJ8B+YRk/06f39wbP1+3rzjM73uSB8bBwzY0+8qqsQht FpIUB1bh0hLSlpkbiBPScccvrEoIh8zEJpbwNWF72tCH+ZlZJiF7kJ95NgDWOEiC1A2s 468Q== MIME-Version: 1.0 X-Received: by 10.229.239.197 with SMTP id kx5mr35172323qcb.14.1403004838089; Tue, 17 Jun 2014 04:33:58 -0700 (PDT) Sender: are.you.winning@gmail.com Received: by 10.229.149.73 with HTTP; Tue, 17 Jun 2014 04:33:58 -0700 (PDT) In-Reply-To: References: <20140617110758.GD24253@methuselah> Date: Tue, 17 Jun 2014 12:33:58 +0100 X-Google-Sender-Auth: st6thElHMPrqqywfWdpGb5rxuhA Message-ID: To: Julien Pauli Cc: Martin Pelikan , PHP Internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] Refactoring our IO multiplexing layer From: daverandom@php.net (Chris Wright) 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. 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). > 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. 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. Thanks, Chris