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 C4B75200C81 for ; Fri, 26 May 2017 17:23:04 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id C3500160BB8; Fri, 26 May 2017 15:23:04 +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 E1761160BAF for ; Fri, 26 May 2017 17:23:03 +0200 (CEST) Received: (qmail 11398 invoked by uid 500); 26 May 2017 15:23:03 -0000 Mailing-List: contact dev-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list dev@activemq.apache.org Received: (qmail 11386 invoked by uid 99); 26 May 2017 15:23:02 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 26 May 2017 15:23:02 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 4D91D1A0C8A for ; Fri, 26 May 2017 15:23:02 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.379 X-Spam-Level: X-Spam-Status: No, score=0.379 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SORBS_SPAM=0.5, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd2-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id 8DSIR0xdQatE for ; Fri, 26 May 2017 15:23:00 +0000 (UTC) Received: from mail-oi0-f42.google.com (mail-oi0-f42.google.com [209.85.218.42]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 51CC65F640 for ; Fri, 26 May 2017 15:23:00 +0000 (UTC) Received: by mail-oi0-f42.google.com with SMTP id h4so16600753oib.3 for ; Fri, 26 May 2017 08:23:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:content-transfer-encoding:mime-version:subject:date:references :to:in-reply-to:message-id; bh=CsRA1Fg4wtWfWnrk8GOndI0XQ0EViGuF5Z2vFfEJGck=; b=Cu1DM4aNXN3KGEyQuIl2Lko5+o3hqdF7J6t7c3ARG/Q1KesIUD1vf1vuMauGV2Uycg UczNeRozSYcq3P5GfWrVUmSFr2DiYPrMRkwrOmYYsmUidBGG7EQpLK5f0xfN99Iy/7mz B/Ju6lIIZApjWETCfRx6qvw3cVA6IxA/r7FQm8c+TaIkuEK21/UvgySjkmnIZq+ZkG7p ErbPRVFiwSgBuvAMsx6ep6rPoZ4vSV4KzCFWTN6yhhnm6ZjgBLejE45XkSxYjhE5vU9v Fqw5WboD9SJZ3ssT52UEgc9tS3l7l4vRaevv5dpZab/OZotnkvjx5DZsFJSiSs/BS1Z9 HJXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:content-transfer-encoding:mime-version :subject:date:references:to:in-reply-to:message-id; bh=CsRA1Fg4wtWfWnrk8GOndI0XQ0EViGuF5Z2vFfEJGck=; b=uJjodVWFIfzBSKMe8B6fGGzn7nMTEvLj37P0xhRZNYOfBeLC4j8oZFnY3C3pdkEUa6 ++6Cr2vseNW7TtS9v2tghAYSMW9LA8LfK6nksUB3EZ+pEdIp3s96ty8Z3qDVUj8l2ptX VZLIWJB3VNVSkof1TkRMj2WzCCm7qlvEXulwCpM9Xh80Z3iC6D50qwTPceFrjfd/FA8k OwXRtRRxVORFsdwFQTOJ77E2xV3iEZjVmNNMwQtC5SOX5x/iO3CfYltEQw0pu4faW9UK B8jAtBhlElphYvaWa8tRcfpRtxZ+Fa4E7UN3Gnw7x6FV/G7Ap/vqHtpEk3Zmpi4D3v2v rP+Q== X-Gm-Message-State: AODbwcDDXqRhK+cJpD0R33UHFnAwc8zvXkhCdaF/9k5ivRBKYNc7V5A8 aI6CQdfl6GAAIYZH1qI= X-Received: by 10.202.230.8 with SMTP id d8mr1174631oih.206.1495812178672; Fri, 26 May 2017 08:22:58 -0700 (PDT) Received: from [192.168.2.106] (216-54-241-218.static.twtelecom.net. [216.54.241.218]) by smtp.gmail.com with ESMTPSA id r138sm411175oie.36.2017.05.26.08.22.57 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 May 2017 08:22:58 -0700 (PDT) From: Matt Pavlovich Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: [DISCUSS] Use pooled buffers on message body Date: Fri, 26 May 2017 10:22:57 -0500 References: <2CAEBF51-1F38-432B-AEF8-8B88C11A05F2@me.com> <07A679E3-34B7-4864-B9EA-763FC6E26E0A@me.com> <92D4B321-146D-4C22-891F-7092B285E5D6@gmail.com> To: dev@activemq.apache.org In-Reply-To: Message-Id: X-Mailer: Apple Mail (2.3273) archived-at: Fri, 26 May 2017 15:23:04 -0000 +1 having the memory pool/allocator be a configurable strategy or = policy-type deal would be bonus level 12. Esp. for embedded / kiosk / = Raspberry Pi and linux host container scenarios as Martyn mentioned. > On May 26, 2017, at 9:50 AM, Clebert Suconic = wrote: >=20 > Perhaps we need a place to set the allocator.. Pooled versus = Unpooled.. >=20 >=20 > PooledRepository.getPool()... >=20 >=20 >=20 > Regarding the ref counts.. we will need to add a new reference > counting.. the current one is a bit complex to be used because of > delivering.. DLQs.. etc... it's a big challenge for sure! >=20 > On Fri, May 26, 2017 at 4:04 AM, Martyn Taylor = wrote: >> We've had using buffer pools throughout on the backlog for a long = time, so >> +1 on this. The only thing I'd say here is that retrofitting the = reference >> counting (i.e. releasing the buffers) can sometimes lead to leaks, if = we >> don't catch all cases, so we just need to be careful here. >>=20 >> One other thing to consider, we do have users that run Artemis in >> constrained environments, where memory is limited. Allocating a = chunk of >> memory upfront for the buffers may not be ideal for that use case. >>=20 >> Cheers >>=20 >> On Thu, May 25, 2017 at 5:53 PM, Matt Pavlovich = wrote: >>=20 >>> +1 this all sounds great >>>=20 >>>> On May 12, 2017, at 12:02 PM, Michael Andr=C3=A9 Pearce < >>> michael.andre.pearce@me.com> wrote: >>>>=20 >>>> I agree iterative targeted steps is best. >>>>=20 >>>> So if even just pooling messages and keep the copying of the buffer = as >>> today it's a step in the right direction. >>>>=20 >>>>=20 >>>> Sent from my iPhone >>>>=20 >>>>> On 12 May 2017, at 15:52, Clebert Suconic = >>> wrote: >>>>>=20 >>>>> I'm not sure we can keep the message body as a native buffer... >>>>>=20 >>>>> I have seen it being expensive. Especially when dealing with >>>>> clustering and paging.. a lot of times I have seen memory = exaustion... >>>>>=20 >>>>> for AMQP, on qpid Proton though.. that would require a lot more >>>>> changes.. it's not even possible to think about it now unless we = make >>>>> substantial changes to Proton.. Proton likes to keep its own = internal >>>>> pool and make a lot of copies.. so we cannot do this yet on AMQP. = (I >>>>> would like to though). >>>>>=20 >>>>>=20 >>>>>=20 >>>>>=20 >>>>> But I'm always in advocating of tackling one thing at the time... >>>>> first thing is to have some reference counting in place to tell us >>>>> when to deallocate the memory used by the message, in such way it >>>>> works with both paging and non paging... anything else then will = be >>>>> "relatively' easier. >>>>>=20 >>>>>=20 >>>>>=20 >>>>> On Fri, May 12, 2017 at 2:56 AM, Michael Andr=C3=A9 Pearce >>>>> wrote: >>>>>>=20 >>>>>> Hi Clebert. >>>>>>=20 >>>>>> +1 from me definitely. >>>>>>=20 >>>>>> Agreed this def should target the server not the clients. >>>>>>=20 >>>>>> Having the message / buffer used my message pooled would be = great, as >>> will reduce GC pressure. >>>>>>=20 >>>>>> I would like to take that one step further and question if we = could >>> actually avoid copying the buffer contents at all on passing from/to = netty. >>> The zero-copy nivana. >>>>>>=20 >>>>>> I know you state to have separate buffer pools. But if we could = use >>> the same memory address we can avoid the copy, reducing latency = also. This >>> could be done by sharing the buffer and the pool, or by using >>> slice/duplicate retained. >>>>>>=20 >>>>>> Cheers >>>>>> Mike >>>>>>=20 >>>>>>=20 >>>>>>=20 >>>>>>> On 11 May 2017, at 23:13, Clebert Suconic = >>> wrote: >>>>>>>=20 >>>>>>> One thing I couldn't do before without some proper thinking was = to use >>>>>>> a Pooled Buffer on the message bodies. >>>>>>>=20 >>>>>>> It would actually rock out the perf numbers if that could be >>> achieved... >>>>>>>=20 >>>>>>>=20 >>>>>>> I'm thinking this should be done on the server only. Doing it on = the >>>>>>> client would mean to give some API to users to tell when the = message >>>>>>> is gone and no longer needed.. I don't think we can do this with = JMS >>>>>>> core, or any of the qpid clients... although we could think = about an >>>>>>> API in the future for such thing. >>>>>>>=20 >>>>>>>=20 >>>>>>>=20 >>>>>>> For the server: I would need to capture when the message is = released.. >>>>>>> the only pitfal for this would be paging as the Page read may = come and >>>>>>> go... So, this will involve some work on making sure we would = call the >>>>>>> proper places. >>>>>>>=20 >>>>>>>=20 >>>>>>> We would still need to copy from Netty Buffer into another >>>>>>> PooledBuffer as the Netty buffer would need to be a Native = buffer >>>>>>> while the message a regular Buffer (non Native). >>>>>>>=20 >>>>>>>=20 >>>>>>> I am thinking of investing my time on this (even if my spare = time if >>>>>>> needed be) after apache con next week. >>>>>>>=20 >>>>>>>=20 >>>>>>> This will certainly attract Francesco and Michael Pierce's = attention.. >>>>>>> but this would be a pretty good improvement towards even less GC >>>>>>> pressure. >>>>>>>=20 >>>>>>>=20 >>>>>>>=20 >>>>>>>=20 >>>>>>>=20 >>>>>>> -- >>>>>>> Clebert Suconic >>>>>=20 >>>>>=20 >>>>>=20 >>>>> -- >>>>> Clebert Suconic >>>=20 >>>=20 >=20 >=20 >=20 > --=20 > Clebert Suconic