rmetzger commented on a change in pull request #15064:
URL: https://github.com/apache/flink/pull/15064#discussion_r596594429



##########
File path: docs/content/docs/deployment/elastic_scaling.md
##########
@@ -0,0 +1,107 @@
+---
+title: Elastic Scaling
+weight: 5
+type: docs
+
+---
+<!--
+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.
+-->
+
+# Elastic Scaling
+
+Flink allows you to adjust your cluster size to your workloads. This is 
possible manually by stopping a job with a savepoint and restarting it from the 
savepoint with a different parallelism. 
+
+This page describes options where Flink automatically adjusts the parallelism.
+
+## Reactive Mode
+
+{{< hint danger >}}
+Reactive mode is a MVP ("minimum viable product") feature. The Flink community 
is actively looking for feedback by users through our mailing lists. Please 
check the limitations listed on this page.
+{{< /hint >}}
+
+Reactive Mode configures Flink so that it always uses all resources made 
available to Flink. Adding a TaskManager will scale up your job, removing 
resources will scale it down. Flink will manage the parallelism of a job's 
operators, always setting them to the highest possible values.
+
+The Reactive Mode allows Flink users to implement a powerful autoscaling 
mechanism, by having an external service monitor certain metrics, such as 
consumer lag, aggregate CPU utilization, throughput or latency. As soon as 
these metrics are above or below a certain threshold, additional TaskManagers 
can be added or removed from the Flink cluster. This could be implemented 
through changing the [replica 
factor](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#replicas)
 of a Kubernetes deployment, or an 
[autoscaling](https://docs.aws.amazon.com/autoscaling/ec2/userguide/AutoScalingGroup.html)
 group. This external service only needs to handle the resource allocation and 
deallocation. Flink will take care of keeping the job running with the 
resources available.
+ 
+### Getting started
+
+If you just want to try out Reactive Mode, follow these instructions. They 
assume that you are deploying Flink on one machine.
+
+```bash
+
+# these instructions assume you are in the root directory of a Flink 
distribution.
+
+# Put Job into lib/ directory
+cp ./examples/streaming/TopSpeedWindowing.jar lib/
+# Submit Job in Reactive Mode
+./bin/standalone-job.sh start -Drestart-strategy=fixeddelay 
-Drestart-strategy.fixed-delay.attempts=100000 -Dscheduler-mode=reactive -j 
org.apache.flink.streaming.examples.windowing.TopSpeedWindowing
+# Start first TaskManager
+./bin/taskmanager.sh start
+```
+
+Let's quickly examine the used submission command:
+- `./bin/standalone-job.sh start` deploys Flink in [Application Mode]({{< ref 
"docs/deployment/overview" >}}#application-mode)
+- `-Drestart-strategy=fixeddelay` and 
`-Drestart-strategy.fixed-delay.attempts=100000` configure the job to restart 
on failure. This is needed for supporting scale-down.
+- `-Dscheduler-mode=reactive` enables Reactive Mode.
+- the last argument is passing the Job's main class name.
+
+You have now started a Flink job in Reactive Mode. The [web 
interface](http://localhost:8081) shows that the job is running on one 
TaskManager. If you want to scale up the job, simply add another TaskManager to 
the cluster:
+```bash
+# Start additional TaskManager
+./bin/taskmanager.sh start
+```
+
+To scale down, remove a TaskManager instance.
+```bash
+# Remove a TaskManager
+./bin/taskmanager.sh stop
+```
+
+### Usage
+
+#### Configuration
+
+To enable Reactive Mode, you need to configure `scheduler-mode` to `reactive`.
+
+#### Parallelism
+
+The **parallelism of individual operators in a job will be determined by the 
scheduler**. It is not configurable. 
+
+The only way of influencing the parallelism is by setting a max parallelism 
for a operator (which will be respected by the scheduler). The maxParallelism 
is bounded by 2^15 (32768), which is the value that Reactive Mode uses if 
nothing else is configured. If there is no maxParallelism defined for an 
operator, `32768` will be used as a default.

Review comment:
       Thank you for filing a ticket!




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to