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 BC2F0175BE for ; Thu, 5 Mar 2015 14:36:43 +0000 (UTC) Received: (qmail 33971 invoked by uid 500); 5 Mar 2015 14:36:38 -0000 Delivered-To: apmail-cassandra-commits-archive@cassandra.apache.org Received: (qmail 33932 invoked by uid 500); 5 Mar 2015 14:36:38 -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 33918 invoked by uid 99); 5 Mar 2015 14:36:38 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 Mar 2015 14:36:38 +0000 Date: Thu, 5 Mar 2015 14:36:38 +0000 (UTC) From: "Branimir Lambov (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=14348795#comment-14348795 ] Branimir Lambov commented on CASSANDRA-8915: -------------------------------------------- Yes, what I'm suggesting is a replacement of the priority queue with a custom version that supports {{swapHead}}. It actually doesn't have to be a full PQ implementation, {{swapHead}} is the only operation needed (the initial heap construction can be done by sorting). > 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 > > 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)