Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id D3375200CF0 for ; Thu, 7 Sep 2017 22:02:08 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id D1A6F16098B; Thu, 7 Sep 2017 20:02:08 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 272C11609BF for ; Thu, 7 Sep 2017 22:02:08 +0200 (CEST) Received: (qmail 86435 invoked by uid 500); 7 Sep 2017 20:02:06 -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 86417 invoked by uid 99); 7 Sep 2017 20:02:06 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Sep 2017 20:02:06 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 05297D8082 for ; Thu, 7 Sep 2017 20:02:06 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.201 X-Spam-Level: X-Spam-Status: No, score=-99.201 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id Ea5_kKHZYJqQ for ; Thu, 7 Sep 2017 20:02:01 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 226F161257 for ; Thu, 7 Sep 2017 20:02:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 990CCE046B for ; Thu, 7 Sep 2017 20:02:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 4E4112414B for ; Thu, 7 Sep 2017 20:02:00 +0000 (UTC) Date: Thu, 7 Sep 2017 20:02:00 +0000 (UTC) From: "Jason Brown (JIRA)" To: commits@cassandra.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CASSANDRA-13789) Reduce memory copies and object creations when acting on ByteBufs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Thu, 07 Sep 2017 20:02:09 -0000 [ https://issues.apache.org/jira/browse/CASSANDRA-13789?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16157547#comment-16157547 ] Jason Brown commented on CASSANDRA-13789: ----------------------------------------- Pushed a fix here: ||13789-fixes|| |[branch|https://github.com/jasobrown/cassandra/tree/13789-fixes]| |[dtest|https://builds.apache.org/view/A-D/view/Cassandra/job/Cassandra-devbranch-dtest/291/]| |[utests|https://circleci.com/gh/jasobrown/cassandra/tree/13789-fixes]| The problem was in [~norman]'s patch, in both {{CBUtil#writeString}} and {{CBUtil#writeLongString}} he was bumping the writerIndex via {{ByteBuf#writerIndex(int)}}. The problem is that if the new writerIndex value exceeds the capacity of the buffer it throws an {{IndexOutOfBoundsException}}. Previously, we were calling {{ByteBuf#writeShort}} or {{ByteBuf#writeLong}}, which reallocates the buffer if the new writerIndex is larger than the current size. For now, I've reverted to calling {{ByteBuf#writeShort}} (or {{ByteBuf#writeLong}}), to restore previous behavior (that passes!), and I've added a new {{CBUtilTest}}, as well. As a further optimization, we can find out why the {{ByteBuf}} is being reallocated to begin with, but that's for another jira. > Reduce memory copies and object creations when acting on ByteBufs > ------------------------------------------------------------------ > > Key: CASSANDRA-13789 > URL: https://issues.apache.org/jira/browse/CASSANDRA-13789 > Project: Cassandra > Issue Type: Improvement > Reporter: Norman Maurer > Assignee: Norman Maurer > Fix For: 4.0 > > Attachments: 0001-CBUtil.sizeOfLongString-encodes-String-to-byte-to-ca.patch, 0001-Reduce-memory-copies-and-object-creations-when-actin.patch > > > There are multiple "low-hanging-fruits" when it comes to reduce memory copies and object allocations when acting on ByteBufs. -- This message was sent by Atlassian JIRA (v6.4.14#64029) --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org For additional commands, e-mail: commits-help@cassandra.apache.org