Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:81878 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 5066 invoked from network); 5 Feb 2015 08:54:16 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Feb 2015 08:54:16 -0000 Authentication-Results: pb1.pair.com smtp.mail=smalyshev@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=smalyshev@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.192.181 as permitted sender) X-PHP-List-Original-Sender: smalyshev@gmail.com X-Host-Fingerprint: 209.85.192.181 mail-pd0-f181.google.com Received: from [209.85.192.181] ([209.85.192.181:44387] helo=mail-pd0-f181.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B2/49-51979-6BF23D45 for ; Thu, 05 Feb 2015 03:54:14 -0500 Received: by pdbft15 with SMTP id ft15so6523657pdb.11 for ; Thu, 05 Feb 2015 00:54:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=djCH0nZ333M2UQj84bpALCB2O01+pY5l7U/OPUAja+c=; b=jo5ephdgNfrc3ookujaNQnJV5VE5j9ecMuhknk/x5Mv/eEZfwuNjPjcNtgXN6rKjeo NqbfFs6B29n5+RJqOCBCV/A5mQC0gkCWrHb18es8GUMnBHBEN30+5Ho7kEZaypom5lCa /GjD0szACwBt3P1HvN6BW7iPxy0MuwjotkwjrupKzfp5mHq0D5lKFrMCpMYwSa1qcEoa /hFkfdQVe3bRrMWEGnBi8ZskjAZYm2LBLeMPhwpXrfU4OnKEmNDTl1ckddXTAney3rRU bzZUaMVq+kXEAboCN+upqZPVFKhLDFpLmCQ7rTvBuJ/ZsRq1RUz58mf4oqN5z+qRFzBl oBfQ== X-Received: by 10.66.136.17 with SMTP id pw17mr3358667pab.33.1423126451711; Thu, 05 Feb 2015 00:54:11 -0800 (PST) Received: from Stas-Air.local (108-66-6-48.lightspeed.sntcca.sbcglobal.net. [108.66.6.48]) by mx.google.com with ESMTPSA id i16sm4330209pbq.70.2015.02.05.00.54.10 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Feb 2015 00:54:10 -0800 (PST) Message-ID: <54D32FA7.8040807@gmail.com> Date: Thu, 05 Feb 2015 00:53:59 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Michael Wallner , PHP Internals References: <54D217E7.8030407@php.net> <54D2AE91.8090800@gmail.com> <54D3271E.2080207@php.net> <54D32A38.9050004@gmail.com> <54D32D89.7010509@php.net> In-Reply-To: <54D32D89.7010509@php.net> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] Re: [RFC] [DISCUSSION] pecl_http From: smalyshev@gmail.com (Stanislav Malyshev) Hi! > Databases (see my pecl/pq example in the RFC), key/value stores, message > queues, whatever you can think of. HTTP and databases are principally different. HTTP protocol is stateless message-oriented protocol, and database connection protocols have very little in common with HTTP. > To demonstrate to ou how it would work out over multiple requests. But this example doesn't demonstrate doing something that people actually would or should do. And it also doesn't demonstrate a need for persisting HTTP connections across requests. In fact, it may be harmful for HTTP servers if connections were not closed when the user is done with them but the server is forced to keep them open beyond the time needed to serve the actual client. > Why do you think the connection should automatically be closed? > That's not the default case since HTTP/1.1, except the server is > explicitely configured to close each connection after serving. If the client is done with the connection, it is natural to assume it is closed. If it's not, then client failing to finish the communication for some reason may leave connection in wrong state and the other client may unsuspectingly reuse it, leading to very weird results. >>> █ mike@smugmug:~$ time php -d raphf.persistent_handle.limit=0 -r 'for >>> ($i=0;$i<20;++$i) {(new http\Client("curl","google"))->enqueue(new >>> http\Client\Request("GET", "http://www.google.at/"))->send();}' >>> >>> 0.04s user 0.01s system 1% cpu 2.790 total >> >> So, the difference is microscopic even here. But with proper HTTP >> handling - like batch requests or keepalive - it would be even less. > > Microscopic?! 50%?! Could you please elaborate? :) Sorry, I looked at wrong number, there is a difference. But if you need to talk a lot to the same service, why not just use keepalive connection for all your requests? As I said, sharing connections between unsuspecting clients may lead to problems. -- Stas Malyshev smalyshev@gmail.com