flink-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] (FLINK-9969) Unreasonable memory requirements to complete examples/batch/WordCount
Date Fri, 03 Aug 2018 07:17:00 GMT

    [ https://issues.apache.org/jira/browse/FLINK-9969?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16567865#comment-16567865
] 

ASF GitHub Bot commented on FLINK-9969:
---------------------------------------

tillrohrmann commented on a change in pull request #6479: [FLINK-9969][batch] Dispose InMemorySorters
created by the UnilateralSortMerger
URL: https://github.com/apache/flink/pull/6479#discussion_r207459818
 
 

 ##########
 File path: flink-runtime/src/main/java/org/apache/flink/runtime/operators/sort/DefaultInMemorySorterFactory.java
 ##########
 @@ -0,0 +1,80 @@
+/*
+ * 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.flink.runtime.operators.sort;
+
+import org.apache.flink.api.common.typeutils.TypeComparator;
+import org.apache.flink.api.common.typeutils.TypeSerializer;
+import org.apache.flink.api.common.typeutils.TypeSerializerFactory;
+import org.apache.flink.core.memory.MemorySegment;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+import java.util.List;
+
+/**
+ * Default factory for {@link InMemorySorter}.
+ */
+public class DefaultInMemorySorterFactory<T> implements InMemorySorterFactory<T>
{
+
+	@Nonnull
+	private final TypeSerializerFactory<T> typeSerializerFactory;
+
+	@Nonnull
+	private final TypeComparator<T> typeComparator;
+
+	private final boolean useFixedLengthRecordSorter;
+
+	@Nullable
+	private TypeSerializer<T> initialSerializer;
+
+	DefaultInMemorySorterFactory(
+			@Nonnull TypeSerializerFactory<T> typeSerializerFactory,
+			@Nonnull TypeComparator<T> typeComparator,
+			int thresholdForInPlaceSorting) {
+		this.typeSerializerFactory = typeSerializerFactory;
+		this.typeComparator = typeComparator;
+
+		this.initialSerializer = typeSerializerFactory.getSerializer();
+
+		this.useFixedLengthRecordSorter = typeComparator.supportsSerializationWithKeyNormalization()
&&
+			initialSerializer.getLength() > 0 && initialSerializer.getLength() <= thresholdForInPlaceSorting;
+	}
+
+	@Override
+	public InMemorySorter<T> create(List<MemorySegment> sortSegments) {
+
+		final TypeSerializer<T> typeSerializer;
+
+		if (initialSerializer == null) {
+			typeSerializer = typeSerializerFactory.getSerializer();
+		} else {
+			typeSerializer = initialSerializer;
 
 Review comment:
   Yes, the `initialSerializer` is an optimization to decrease the number of created `TypeSerializer`
instances at the cost of a slightly more complicated `create` method. I guess both ways should
work given that the `UnilateralSortMerger` does not create thousands of `InMemorySorters`.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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


> Unreasonable memory requirements to complete examples/batch/WordCount
> ---------------------------------------------------------------------
>
>                 Key: FLINK-9969
>                 URL: https://issues.apache.org/jira/browse/FLINK-9969
>             Project: Flink
>          Issue Type: Bug
>          Components: ResourceManager
>    Affects Versions: 1.5.0, 1.5.1, 1.5.2, 1.6.0
>            Reporter: Piotr Nowojski
>            Assignee: Till Rohrmann
>            Priority: Blocker
>              Labels: pull-request-available
>             Fix For: 1.5.3, 1.6.0
>
>         Attachments: yarn_logs
>
>
> setup on AWS EMR:
>  * 5 worker nodes (m4.4xlarge nodes) 
>  * 1 master node (m4.large)
> following command fails with out of memory errors:
> {noformat}
> export HADOOP_CLASSPATH=`hadoop classpath`
> ./bin/flink run -m yarn-cluster -p 20 -yn 5 -ys 4 -ytm 16000 examples/batch/WordCount.jar{noformat}
> Only increasing memory over 17.2GB example completes. At the same time after disabling
flip6 following command succeeds:
> {noformat}
> export HADOOP_CLASSPATH=`hadoop classpath`
> ./bin/flink run -m yarn-cluster -p 20 -yn 5 -ys 4 -ytm 1000 examples/batch/WordCount.jar{noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message