activemq-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (ARTEMIS-1586) Reduce GC pressure due to String allocations on Core protocol
Date Fri, 05 Jan 2018 23:51:00 GMT

    [ 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 <T>} interner.
    + * <p>
    + * 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<T> {
    --- 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)

Mime
View raw message