Return-Path: X-Original-To: apmail-cassandra-commits-archive@www.apache.org Delivered-To: apmail-cassandra-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id ED5D018FAB for ; Wed, 15 Jul 2015 10:08:04 +0000 (UTC) Received: (qmail 9054 invoked by uid 500); 15 Jul 2015 10:08:04 -0000 Delivered-To: apmail-cassandra-commits-archive@cassandra.apache.org Received: (qmail 9019 invoked by uid 500); 15 Jul 2015 10:08:04 -0000 Mailing-List: contact commits-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cassandra.apache.org Delivered-To: mailing list commits@cassandra.apache.org Received: (qmail 9006 invoked by uid 99); 15 Jul 2015 10:08:04 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 15 Jul 2015 10:08:04 +0000 Date: Wed, 15 Jul 2015 10:08:04 +0000 (UTC) From: "Benedict (JIRA)" To: commits@cassandra.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CASSANDRA-8915) Improve MergeIterator performance MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CASSANDRA-8915?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14627840#comment-14627840 ] Benedict commented on CASSANDRA-8915: ------------------------------------- [~blambov]: I realise this isn't marked as critical for 3.0, but it's a nice improvement and the only hurdle is a rebase / flatten - otherwise I'm happy and ready to commit. Would you mind prepping that when you have a moment? > Improve MergeIterator performance > --------------------------------- > > Key: CASSANDRA-8915 > URL: https://issues.apache.org/jira/browse/CASSANDRA-8915 > Project: Cassandra > Issue Type: Improvement > Reporter: Branimir Lambov > Assignee: Branimir Lambov > Priority: Minor > Labels: compaction, performance > Fix For: 3.x > > Time Spent: 0.2h > Remaining Estimate: 0h > > The implementation of {{MergeIterator}} uses a priority queue and applies a pair of {{poll}}+{{add}} operations for every item in the resulting sequence. This is quite inefficient as {{poll}} necessarily applies at least {{log N}} comparisons (up to {{2log N}}), and {{add}} often requires another {{log N}}, for example in the case where the inputs largely don't overlap (where {{N}} is the number of iterators being merged). > This can easily be replaced with a simple custom structure that can perform replacement of the top of the queue in a single step, which will very often complete after a couple of comparisons and in the worst case scenarios will match the complexity of the current implementation. > This should significantly improve merge performance for iterators with limited overlap (e.g. levelled compaction). -- This message was sent by Atlassian JIRA (v6.3.4#6332)