Req #71832 [Com]: Support for persistent connections

From: Date: Wed, 28 Feb 2018 12:38:15 +0000
Subject: Req #71832 [Com]: Support for persistent connections
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-214138@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71832&edit=1

 ID:                 71832
 Comment by:         spam2 at rhsoft dot net
 Reported by:        rmoisto at gmail dot com
 Summary:            Support for persistent connections
 Status:             Open
 Type:               Feature/Change Request
 Package:            cURL related
 PHP Version:        Irrelevant
 Block user comment: N
 Private report:     N

 New Comment:

> For example even in my very fast local network the 
> time spent establishing a connection is around 60 ms

then your error is somewhere else
the 26 ms at the bottom are non-keep-alive requests over vpn and WAN

[harry@srv-rhsoft:~]$ response-times.sh
DOMAIN:                   http://corecms
COUNT:                    250
CMS UNCACHED:             2370 us
CMS CACHED:               978 us
STATIC HTM:               737 us
STATIC PHP:               879 us
FACTOR CMS/STATIC HTM:    3.2
FACTOR CMS/STATIC PHP:    2.7
FACTOR CACHED/STATIC HTM: 1.3
FACTOR CACHED/STATIC PHP: 1.1
FACTOR STATIC PHP/STATIC: 1.2
RUNTIME:                  1.778

Concurrency Level:      1
Time taken for tests:   26.715 seconds
Complete requests:      1000
Failed requests:        0
Total transferred:      4074590 bytes
HTML transferred:       3777476 bytes
Requests per second:    37.43 [#/sec] (mean)
Time per request:       26.715 [ms] (mean)
Time per request:       26.715 [ms] (mean, across all concurrent requests)
Transfer rate:          148.95 [Kbytes/sec] received


Previous Comments:
------------------------------------------------------------------------
[2018-02-28 12:05:44] rmoisto at gmail dot com

As a workaround I'm in the process of building an nginx reverse proxy that can hold persistent
connections. The performance gains for EU - US connections are massive. Even with the nginx proxy
overhead requests are on average 900 ms faster.

------------------------------------------------------------------------
[2016-03-15 19:39:05] rmoisto at gmail dot com

Description:
------------
There should be a way of persisting and caching cURL http(s) connections between requests.

Trying to find a solution, it seems the nature of PHP doesn't currently allow for this in any
way, without writing an extension of course. Every time a request comes in I have to create a new
cURL handle and therefore a new connection at least once.

It's a big performance issue on proxy systems like what I'm working on. For example even
in my very fast local network the time spent establishing a connection is around 60 ms.

The issue and solution are much better explained in the description of an extension that only exists
for hvvm:
https://github.com/mobfox/hhvm_ext_pcurl



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=71832&edit=1


Thread (9 messages)

« previous php.bugs (#214138) next »