Aaron Schulz has submitted this change and it was merged.

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(-)

Approvals:
  Aaron Schulz: Verified
  GWicke: Looks good to me, approved



diff --git a/php-cloudfiles-wmf/cloudfiles_http.php 
b/php-cloudfiles-wmf/cloudfiles_http.php
index e6e3c9d..ed60f91 100644
--- a/php-cloudfiles-wmf/cloudfiles_http.php
+++ b/php-cloudfiles-wmf/cloudfiles_http.php
@@ -1687,6 +1687,8 @@
                                $handle = $request->getStepHandle( $stage );
                                if ( $handle && !$request->failed ) { // has 
step
                                        $request->state = 
CF_Async_Op::STATE_STARTED;
+                                       // 
https://github.com/guzzle/guzzle/issues/349
+                                       curl_setopt( $handle, 
CURLOPT_FORBID_REUSE, true );
                                        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: merged
Gerrit-Change-Id: I3573dd8212d19e3bfebeb5a7f1a5d2425ebd4426
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/SwiftCloudFiles
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Aaron Schulz <[email protected]>
Gerrit-Reviewer: GWicke <[email protected]>

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

Reply via email to