GWicke has uploaded a new change for review. https://gerrit.wikimedia.org/r/92327
Change subject: Disable persistent connections in curl client ...................................................................... Disable persistent connections in curl client This is a port of https://gerrit.wikimedia.org/r/#/c/92010/, which fixed a performance regression core. This might be specific to a broken HTTP pipelining implementation in Swift, but for good measure it is a good idea to port this to our curl client too. TODO: Develop a shared curl_multi client in core Change-Id: I92d3d4e20dc59b07b2e7964e5b979ca05ff71250 --- M php/CurlMultiClient.php 1 file changed, 11 insertions(+), 9 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Parsoid refs/changes/27/92327/1 diff --git a/php/CurlMultiClient.php b/php/CurlMultiClient.php index 6a4bdc0..27e4612 100644 --- a/php/CurlMultiClient.php +++ b/php/CurlMultiClient.php @@ -51,7 +51,11 @@ // add curl options to each handle foreach ( $requests as $k => $row ) { $handle = curl_init(); - $reqOptions = array( CURLOPT_URL => $row['url'] ) + $options; + $reqOptions = array( + CURLOPT_URL => $row['url'], + // https://github.com/guzzle/guzzle/issues/349 + CURLOPT_FORBID_REUSE => true + ) + $options; wfDebug( "adding url: " . $row['url'] ); if ( isset( $row['headers'] ) ) { $reqOptions[CURLOPT_HTTPHEADER] = $row['headers']; @@ -67,25 +71,23 @@ curl_multi_add_handle( $mh, $handle ); } - $running_handles = null; + $active = null; // handles still being processed //execute the handles do { do { // perform work as long as there is any - $status_cme = curl_multi_exec( $mh, $running_handles ); + $status_cme = curl_multi_exec( $mh, $active ); } while ( $status_cme == CURLM_CALL_MULTI_PERFORM ); - if ( $running_handles > 0 ) { + if ( $active > 0 && status_cme === CURLM_OK ) { // wait for more work to become available - $select_status = curl_multi_select( $mh, 10 ); - if ( $select_status == -1 ) { - // Wait for 10 ms, somewhat similar to the suggestion at + if ( curl_multi_select( $mh, 10 ) ) { + // Wait for 5 ms, somewhat similar to the suggestion at // http://curl.haxx.se/libcurl/c/curl_multi_fdset.html // We pick a smaller value as we are typically hitting // fast internal services so status changes are more // likely. - usleep(10000); + usleep(5000); } - } } while ( $running_handles && $status_cme == CURLM_OK ); -- To view, visit https://gerrit.wikimedia.org/r/92327 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I92d3d4e20dc59b07b2e7964e5b979ca05ff71250 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Parsoid Gerrit-Branch: master Gerrit-Owner: GWicke <[email protected]> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
