From issues-return-24179-archive-asf-public=cust-asf.ponee.io@activemq.apache.org Sat Jan 6 00:51:10 2018 Return-Path: X-Original-To: archive-asf-public@eu.ponee.io Delivered-To: archive-asf-public@eu.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by mx-eu-01.ponee.io (Postfix) with ESMTP id 8C902180647 for ; Sat, 6 Jan 2018 00:51:10 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 7C820160C3B; Fri, 5 Jan 2018 23:51:10 +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 C28B7160C27 for ; Sat, 6 Jan 2018 00:51:09 +0100 (CET) Received: (qmail 51990 invoked by uid 500); 5 Jan 2018 23:51:09 -0000 Mailing-List: contact issues-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 issues@activemq.apache.org Received: (qmail 51981 invoked by uid 99); 5 Jan 2018 23:51:08 -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; Fri, 05 Jan 2018 23:51:08 +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 637D4C35D5 for ; Fri, 5 Jan 2018 23:51:08 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.911 X-Spam-Level: X-Spam-Status: No, score=-99.911 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01, 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 hkIWZm48kuv9 for ; Fri, 5 Jan 2018 23:51:07 +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 C732C5F6C8 for ; Fri, 5 Jan 2018 23:51:06 +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 24A19E25AE for ; Fri, 5 Jan 2018 23:51:05 +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 80AF62411E for ; Fri, 5 Jan 2018 23:51:00 +0000 (UTC) Date: Fri, 5 Jan 2018 23:51:00 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: issues@activemq.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (ARTEMIS-1586) Reduce GC pressure due to String allocations on Core protocol 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/ARTEMIS-1586?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16314156#comment-16314156 ] ASF GitHub Bot commented on ARTEMIS-1586: ----------------------------------------- Github user franz1981 commented on a diff in the pull request: https://github.com/apache/activemq-artemis/pull/1752#discussion_r160005087 --- Diff: artemis-commons/src/main/java/org/apache/activemq/artemis/utils/AbstractInterner.java --- @@ -0,0 +1,157 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.activemq.artemis.utils; + +import io.netty.buffer.ByteBuf; +import io.netty.util.internal.MathUtil; +import io.netty.util.internal.PlatformDependent; + +/** + * Thread-safe {@code } interner. + *

+ * Differently from {@link String#intern()} it contains a fixed amount of entries and + * when used by concurrent threads it doesn't ensure the uniqueness of the entries ie + * the same entry could be allocated multiple times by concurrent calls. + */ +public abstract class AbstractInterner { --- End diff -- Tomorrow (today in Italy :)) I will provide a JMH benchmark to show the difference between each approach (guava too), but consider the semantic differences between the interners: mine is packing all the pooled instances into a Object[] of fixed size not scattered along the heap and without using memory barriers to solve the potential races, while the Guava one is using a concurrent hash map with soft references, so the comparision won't be 100% fair. > Reduce GC pressure due to String allocations on Core protocol > ------------------------------------------------------------- > > Key: ARTEMIS-1586 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1586 > Project: ActiveMQ Artemis > Issue Type: Improvement > Reporter: Francesco Nigro > Assignee: Francesco Nigro > > The core protocol produce a huge amount of StringValue/SimpleString instances during CoreMessage decoding of SessionSendMessages. > Often these instances are the same during the lifetime of a client/server connection: providing efficient interners would help to reduce the GC pressure, increasing the broker capacity/scalability. -- This message was sent by Atlassian JIRA (v6.4.14#64029)