2016-06-20 14 views
0

Dies ist ein Teil des ursprünglichen WordCount.java-Codes. Flink InvocationTargetException. Unzureichende Anzahl der Netzwerkpuffer

public static void main(String[] args) throws Exception { 

    // set up the execution environment 
    final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); 

    // get input data 
    DataSet<String> text = env.fromElements(
      "To be, or not to be,--that is the question:--", 
      "Whether 'tis nobler in the mind to suffer", 
      "The slings and arrows of outrageous fortune", 
      "Or to take arms against a sea of troubles," 
      ); 
    //DataSet<String> text = env.readTextFile("file:///home/jypark2/data3.txt"); 

    DataSet<Tuple2<String, Integer>> counts = 
      // split up the lines in pairs (2-tuples) containing: (word,1) 
      text.flatMap(new LineSplitter()) 
      // group by the tuple field "0" and sum up tuple field "1" 
      .groupBy(0) 
      .sum(1); 

    // execute and print result 
    counts.print(); 

} 

Ich wollte von Textdatei lesen, so ich diesen Code geändert.

public static void main(String[] args) throws Exception { 

    // set up the execution environment 
    final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); 

    // get input data 

    DataSet<String> text = env.readTextFile("file:///home/jypark2/data3.txt"); 

    DataSet<Tuple2<String, Integer>> counts = 
      // split up the lines in pairs (2-tuples) containing: (word,1) 
      text.flatMap(new LineSplitter()) 
      // group by the tuple field "0" and sum up tuple field "1" 
      .groupBy(0) 
      .sum(1); 

    // execute and print result 
    counts.print(); 

} 

Aber es gibt einen Laufzeitfehler. Aber ich kann das nicht lösen.

enter image description here

Warum ist es passiert und wie kann ich es beheben?

Antwort

0

Wenn Sie Flink in einer massiv parallelen Einstellung (100+ parallele Threads) ausführen, müssen Sie die Anzahl der Netzwerkpuffer über den Konfigurationsparameter taskmanager.network.numberOfBuffers anpassen. Als Faustregel sollte die Anzahl der Puffer mindestens 4 * numberOfTaskManagers * numberOfSlotsPerTaskManager^2 betragen. Details finden Sie in der Konfigurationsreferenz.

Von Flink FAQ: https://flink.apache.org/faq.html#i-get-an-error-message-saying-that-not-enough-buffers-are-available-how-do-i-fix-this

Verwandte Themen