You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2021/01/05 16:49:00 UTC

[jira] [Work logged] (ARTEMIS-3016) Reduce DuplicateIDCache memory footprint

     [ https://issues.apache.org/jira/browse/ARTEMIS-3016?focusedWorklogId=531336&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-531336 ]

ASF GitHub Bot logged work on ARTEMIS-3016:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 05/Jan/21 16:48
            Start Date: 05/Jan/21 16:48
    Worklog Time Spent: 10m 
      Work Description: clebertsuconic commented on a change in pull request #3363:
URL: https://github.com/apache/activemq-artemis/pull/3363#discussion_r552055483



##########
File path: artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PersistentDuplicateIDCache.java
##########
@@ -0,0 +1,390 @@
+/*
+ * 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.core.postoffice.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.function.IntFunction;
+
+import org.apache.activemq.artemis.api.core.ActiveMQDuplicateIdException;
+import org.apache.activemq.artemis.api.core.ObjLongPair;
+import org.apache.activemq.artemis.api.core.Pair;
+import org.apache.activemq.artemis.api.core.SimpleString;
+import org.apache.activemq.artemis.core.persistence.StorageManager;
+import org.apache.activemq.artemis.core.postoffice.DuplicateIDCache;
+import org.apache.activemq.artemis.core.server.ActiveMQServerLogger;
+import org.apache.activemq.artemis.core.server.MessageReference;
+import org.apache.activemq.artemis.core.transaction.Transaction;
+import org.apache.activemq.artemis.core.transaction.TransactionOperationAbstract;
+import org.apache.activemq.artemis.utils.ByteUtil;
+import org.jboss.logging.Logger;
+
+import static org.apache.activemq.artemis.api.core.ObjLongPair.NIL;
+import static org.apache.activemq.artemis.core.postoffice.impl.IntegerCache.boxedInts;
+
+/**
+ * A fixed size rotating cache of last X duplicate ids.

Review comment:
       Can you add a comment here on why we did not use Inheritance and reusability?
   
   I spoke with you on this.. I understand the issue.. but if we document with a Javadoc may prevent others from trying to use a single base class.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 531336)
    Time Spent: 6.5h  (was: 6h 20m)

> Reduce DuplicateIDCache memory footprint
> ----------------------------------------
>
>                 Key: ARTEMIS-3016
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-3016
>             Project: ActiveMQ Artemis
>          Issue Type: Improvement
>            Reporter: Francesco Nigro
>            Assignee: Francesco Nigro
>            Priority: Major
>          Time Spent: 6.5h
>  Remaining Estimate: 0h
>
> DuplicateIDCache uses many Long and Integer boxed instances that makes using duplicate caches id too memory hungry. This could be improved by using better data structures and pooling mechanism.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)