You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@paimon.apache.org by "tsreaper (via GitHub)" <gi...@apache.org> on 2024/03/01 07:03:12 UTC

[PR] [core] Remove bucket level metrics because metric names will stay in Flink's jobmanager forever and will cause OOM [incubator-paimon]

tsreaper opened a new pull request, #2930:
URL: https://github.com/apache/incubator-paimon/pull/2930

   ### Purpose
   
   We encountered an issue in production that OOM occurs in Flink's jobmanager. After investigation we found that all metric names will be kept forever in jobmanager's `MetricStore`. As the number of partitions written becomes larger, there will be more and more bucket level metrics, and finally `MetricStore` can't hold them all.
   
   This PR removes all bucket level metrics and replace some of them with aggregated metrics.
   
   ### Tests
   
   * `AggregatedMetricsTest`.
   * `CompactionMetricsTest`.
   * `CompactTimerTest`.
   
   ### API and Format
   
   No.
   
   ### Documentation
   
   This PR affects the list of available metrics. The document is also updated.
   


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org

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


Re: [PR] [core] Remove bucket level metrics because metric names will stay in Flink's jobmanager forever and will cause OOM [incubator-paimon]

Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi commented on code in PR #2930:
URL: https://github.com/apache/incubator-paimon/pull/2930#discussion_r1512152567


##########
paimon-core/src/main/java/org/apache/paimon/operation/metrics/CompactionMetrics.java:
##########
@@ -19,21 +19,34 @@
 package org.apache.paimon.operation.metrics;
 
 import org.apache.paimon.annotation.VisibleForTesting;
-import org.apache.paimon.metrics.Histogram;
+import org.apache.paimon.data.BinaryRow;
 import org.apache.paimon.metrics.MetricGroup;
 import org.apache.paimon.metrics.MetricRegistry;
 
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+import java.util.stream.DoubleStream;
+import java.util.stream.LongStream;
+
 /** Metrics to measure a compaction. */
 public class CompactionMetrics {
 
-    private static final int HISTOGRAM_WINDOW_SIZE = 100;
     private static final String GROUP_NAME = "compaction";
 
+    public static final String MAX_LEVEL0_FILE_COUNT = "maxLevel0FileCount";
+    public static final String AVG_LEVEL0_FILE_COUNT = "avgLevel0FileCount";
+    public static final String MAX_COMPACTION_THREAD_BUSY = "maxCompactionThreadBusy";

Review Comment:
   Each task has only one backend thread, so according to this statement, busy should only have one metric.



-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org

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


Re: [PR] [core] Remove bucket level metrics because metric names will stay in Flink's jobmanager forever and will cause OOM [incubator-paimon]

Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi merged PR #2930:
URL: https://github.com/apache/incubator-paimon/pull/2930


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org

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


Re: [PR] [core] Remove bucket level metrics because metric names will stay in Flink's jobmanager forever and will cause OOM [incubator-paimon]

Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi commented on code in PR #2930:
URL: https://github.com/apache/incubator-paimon/pull/2930#discussion_r1512153354


##########
paimon-core/src/main/java/org/apache/paimon/operation/metrics/MetricUtils.java:
##########
@@ -0,0 +1,33 @@
+/*
+ * 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.paimon.operation.metrics;
+
+import org.slf4j.Logger;
+
+/** Utils for metrics. */
+public class MetricUtils {

Review Comment:
   I think we should avoid same name classes. Here you can rename `org.apache.paimon.flink.utils.MetricUtils` to `org.apache.paimon.flink.utils.FlinkMetricUtils`.



-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org

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


Re: [PR] [core] Remove bucket level metrics because metric names will stay in Flink's jobmanager forever and will cause OOM [incubator-paimon]

Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi commented on PR #2930:
URL: https://github.com/apache/incubator-paimon/pull/2930#issuecomment-1978097932

   +1


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org

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