Manybubbles has uploaded a new change for review. https://gerrit.wikimedia.org/r/106262
Change subject: Add more timing and fix others ...................................................................... Add more timing and fix others The extra timing is around searches. Currently we just trust whatever time comes back from Elasticsearch which isn't cool. What if it lies? What if something makes the round trip take forever? We need to know! Silly microtime needing a ( true ).... Bug: 59821 Change-Id: I74e5eb8168f67855d0fdf58c6013633adba66aae --- M includes/Searcher.php M includes/Updater.php 2 files changed, 10 insertions(+), 7 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CirrusSearch refs/changes/62/106262/1 diff --git a/includes/Searcher.php b/includes/Searcher.php index d366e7d..2a503e7 100644 --- a/includes/Searcher.php +++ b/includes/Searcher.php @@ -643,8 +643,11 @@ $work = new PoolCounterWorkViaCallback( 'CirrusSearch-Search', "_elasticsearch", array( 'doWork' => function() use ( $description, $search ) { try { + $start = microtime( true ); $result = $search->search(); - wfDebugLog( 'CirrusSearch', 'Search completed in ' . $result->getTotalTime() . ' millis' ); + $took = round( ( microtime( true ) - $start ) * 1000 ); + $elasticTook = $result->getTotalTime(); + wfDebugLog( 'CirrusSearch', "Search completed in $took millis and $elasticTook Elasticsearch millis" ); return Status::newGood( $result ); } catch ( \Elastica\Exception\ExceptionInterface $e ) { wfLogWarning( "Search backend error during $description. Error message is: " . $e->getMessage() ); diff --git a/includes/Updater.php b/includes/Updater.php index 707ed8c..3a2a97f 100644 --- a/includes/Updater.php +++ b/includes/Updater.php @@ -446,9 +446,9 @@ $linkCountClosureCount = count( $linkCountClosures ); if ( !$skipLinks && $linkCountClosureCount ) { try { - $start = microtime(); + $start = microtime( true ); $result = $linkCountMultiSearch->search(); - $took = round( ( microtime() - $start ) * 1000 ); + $took = round( ( microtime( true ) - $start ) * 1000 ); $pageCount = count( $pages ); wfDebugLog( 'CirrusSearch', "Counted links to $pageCount pages in $took millis." ); for ( $index = 0; $index < $linkCountClosureCount; $index++ ) { @@ -658,9 +658,9 @@ } // Look up the ids and run all closures to build the bulk update - $start = microtime(); + $start = microtime( true ); $findIdsMultiSearchResult = $findIdsMultiSearch->search(); - $took = round( ( microtime() - $start ) * 1000 ); + $took = round( ( microtime( true ) - $start ) * 1000 ); wfDebugLog( 'CirrusSearch', "Searched for $findIdsClosuresCount ids in other indexes in $took millis." ); for ( $i = 0; $i < $findIdsClosuresCount; $i++ ) { $results = $findIdsMultiSearchResult[ $i ]->getResults(); @@ -679,9 +679,9 @@ // Execute the bulk update $exception = null; try { - $start = microtime(); + $start = microtime( true ); $bulk->send(); - $took = round( ( microtime() - $start ) * 1000 ); + $took = round( ( microtime( true ) - $start ) * 1000 ); wfDebugLog( 'CirrusSearch', "Updated $updatesInBulk documents in other indexes in $took millis." ); } catch ( \Elastica\Exception\Bulk\ResponseException $e ) { if ( self::bulkResponseExceptionIsJustDocumentMissing( $e ) ) { -- To view, visit https://gerrit.wikimedia.org/r/106262 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I74e5eb8168f67855d0fdf58c6013633adba66aae Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/CirrusSearch Gerrit-Branch: master Gerrit-Owner: Manybubbles <never...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits