Aaron Schulz has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/92010


Change subject: Performance tweaks for curl_multi
......................................................................

Performance tweaks for curl_multi

* Avoid massive slowdown due to persistent connection handling
* Avoid extra usleep() call on each request set

Change-Id: I3573dd8212d19e3bfebeb5a7f1a5d2425ebd4426
---
M php-cloudfiles-wmf/cloudfiles_http.php
1 file changed, 7 insertions(+), 3 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SwiftCloudFiles 
refs/changes/10/92010/1

diff --git a/php-cloudfiles-wmf/cloudfiles_http.php 
b/php-cloudfiles-wmf/cloudfiles_http.php
index e6e3c9d..ef53e8e 100644
--- a/php-cloudfiles-wmf/cloudfiles_http.php
+++ b/php-cloudfiles-wmf/cloudfiles_http.php
@@ -1685,6 +1685,8 @@
                        // Add all of the required cURL handles...
                        foreach ( $this->requests as $request ) {
                                $handle = $request->getStepHandle( $stage );
+                               // https://github.com/guzzle/guzzle/issues/349
+                               curl_setopt( $handle, CURLOPT_FORBID_REUSE, 
true );
                                if ( $handle && !$request->failed ) { // has 
step
                                        $request->state = 
CF_Async_Op::STATE_STARTED;
                                        curl_multi_add_handle( $multiHandle, 
$handle );
@@ -1698,9 +1700,11 @@
                                        $mrc = curl_multi_exec( $multiHandle, 
$active );
                                } while ( $mrc == CURLM_CALL_MULTI_PERFORM );
                                // Wait (if possible) for available work...
-                               if ( curl_multi_select( $multiHandle, 10 ) == 
-1 ) {
-                                       // PHP bug 63411; 
http://curl.haxx.se/libcurl/c/curl_multi_fdset.html
-                                       usleep( 5000 ); // 5ms
+                               if ( $active > 0 && $mrc == CURLM_OK ) {
+                                       if ( curl_multi_select( $multiHandle, 
10 ) == -1 ) {
+                                               // PHP bug 63411; 
http://curl.haxx.se/libcurl/c/curl_multi_fdset.html
+                                               usleep( 5000 ); // 5ms
+                                       }
                                }
                        } while ( $active > 0 && $mrc == CURLM_OK );
                        // Remove all of the added cURL handles and check for 
errors...

-- 
To view, visit https://gerrit.wikimedia.org/r/92010
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3573dd8212d19e3bfebeb5a7f1a5d2425ebd4426
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SwiftCloudFiles
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to