title: Some puzzles for the operator Parallelism in Flink
body: <p>I just got the example below for the parallelism and have some related questions:</p>
  
  <ol>
  <li><p>The setParallelism(5) is setting the Parallelism 5 just to sum or both flatMap and sum? </p></li>
  <li><p>Is it possible that we can set the different Parallelism to different operators such as flatMap and sum respectively ?such as set Parallelism 5 to sum and 10 to flatMap .</p></li>
  <li><p>Based on my understanding ,keyBy is partitioning the DataStream to logical Stream\partitions based on the different keys, and suppose there are 10,000 different key values, so there are 10,000 different partitions , then how many threads would deal with the 10,000 partitions? Just 5 threads? How about if we didn't set the  setParallelism(5) ?</p></li>
  </ol>
  
  <p><a href="https://ci.apache.org/projects/flink/flink-docs-release-1.3/dev/parallel.html" rel="noreferrer">https://ci.apache.org/projects/flink/flink-docs-release-1.3/dev/parallel.html</a></p>
  
  <pre class="lang-java prettyprint-override"><code>final StreamExecutionEnvironment env =     
    StreamExecutionEnvironment.getExecutionEnvironment();
  
  DataStream&lt;String&gt; text = [...]
  DataStream&lt;Tuple2&lt;String, Integer&gt;&gt; wordCounts = text
    .flatMap(new LineSplitter())
    .keyBy(0)
    .timeWindow(Time.seconds(5))
    .sum(1).setParallelism(5);
  
  wordCounts.print();
  
  env.execute("Word Count Example");
  </code></pre>