Configure a Flink (VVR) job
E-MapReduce (EMR) versions 3.27.x and earlier use open-source Flink. EMR versions later than 3.27.x use Flink (VVR), an enterprise edition that is fully compatible with open-source Flink. This topic describes how to configure a Flink (VVR) job.
Background information
The Flink enterprise edition is a commercial product from the founding team of Apache Flink.
Flink (VVR) provides an enterprise edition state backend that performs three to five times better than its open-source equivalent. In an E-MapReduce Hadoop cluster, you can use the Flink (VVR) engine and the Data Development feature of EMR to submit jobs. Flink (VVR) is compatible with open-source Flink 1.10 and uses the commercial GeminiStateBackend by default. This backend offers the following features:
-
Uses innovative data structures to improve random query performance and reduce disk read I/O.
-
Optimizes the cache policy. If memory is sufficient, hot data is not written to disk, and the cache remains valid after compaction.
-
A full Java implementation eliminates RocksDB JNI overhead.
-
Uses off-heap memory and an efficient memory allocator based on GeminiDB to eliminate the impact of JVM GC.
-
Supports asynchronous incremental checkpoints. In the synchronous phase, only in-memory indexes are copied. This avoids the I/O jitter that can occur with RocksDB.
-
Supports local recovery and persisting timers to disk.
To use GeminiStateBackend, do not specify a state backend type in your code. To start a job with GeminiStateBackend, the TaskManager (TM) requires at least 1,728 MB of memory.
The basic Flink configurations for checkpoints and state backends also apply to GeminiStateBackend. For more information, see Configuration.
You can configure parameters based on your requirements. The following table describes some special parameters.
|
Parameter |
Description |
|
state.backend.gemini.memory.managed |
The default value is true. If this parameter is set to true, the system automatically calculates the memory for each backend based on the configured managed memory and the number of task slots. Valid values:
|
|
state.backend.gemini.offheap.size |
The default value is 2 GB. If state.backend.gemini.memory.managed is set to false, this parameter specifies the memory for each backend. |
|
state.backend.gemini.local.dir |
Specifies the directory where GeminiDB local data files are stored. |
|
state.backend.gemini.timer-service.factory |
The default value is HEAP. This parameter specifies the storage location for the timer service state. Valid values:
|
Prerequisites
-
You have created a Hadoop cluster.
-
You have created a project.
-
You have the resources required for your job, such as the JAR package, data file names, and their storage paths.
Note-
We recommend storing the JAR package for your job in Object Storage Service (OSS).
-
If you use a local path, use the absolute path of the file.
-
Procedure
-
Go to the Projects page in Data Platform.
-
Log in to the E-MapReduce console with your Alibaba Cloud account.
-
In the top navigation bar, select the region and resource group.
-
Click the Data Development tab.
-
-
In the row of the project you want to edit, click Edit Job.
-
Create a Flink job.
- On the left side of the page, right-click the target folder and select Create Job.
-
In the Create Job dialog box, enter a Job Name and Description for the job. Select Flink from the Job Type drop-down list.
- Click OK.
-
Edit the job content.
-
In the Content section, enter the command-line arguments to submit the job.
-
Flink jobs support Flink Datastream, Table, and SQL jobs packaged in a JAR file. The following code provides an example:
run -m yarn-cluster -yjm 1024 -ytm 2048 ossref://path/to/oss/of/WordCount.jar --input oss://path/to/oss/to/data --output oss://path/to/oss/to/result -
Starting from EMR 3.28.2, Flink jobs also support PyFlink jobs. The following code provides an example:
run -m yarn-cluster -yjm 1024 -ytm 2048 -py ossref://path/to/oss/of/word_count.pySee the official Apache Flink documentation for other available parameters for PyFlink jobs.
-
-
Click Save.
NoteYou can access the Flink web UI based on your cluster version:
-
For EMR versions earlier than 3.29.0
You can only access the web UI using an SSH tunnel.
-
For EMR 3.29.0 and later versions
-
(Recommended) You can access the web UI from the EMR console.
-
You can also access the web UI using an SSH tunnel.
-
-
-