# Test Flink baseline functionality

## In this learning path

- [Introduction](https://learn.arm.com/learning-paths/servers-and-cloud-computing/flink-on-gcp/)
- [Get started with Apache Flink on Google Axion C4A](https://learn.arm.com/learning-paths/servers-and-cloud-computing/flink-on-gcp/background/)
- [Create a Google Axion C4A Arm virtual machine](https://learn.arm.com/learning-paths/servers-and-cloud-computing/flink-on-gcp/instance/)
- [Install Apache Flink](https://learn.arm.com/learning-paths/servers-and-cloud-computing/flink-on-gcp/installation/)
- [Test Flink baseline functionality](https://learn.arm.com/learning-paths/servers-and-cloud-computing/flink-on-gcp/baseline/)
- [Benchmark Flink performance](https://learn.arm.com/learning-paths/servers-and-cloud-computing/flink-on-gcp/benchmarking/)
- [Next Steps](https://learn.arm.com/learning-paths/servers-and-cloud-computing/flink-on-gcp/_next-steps/)

## Apache Flink Baseline Testing on GCP SUSE VM
In this section you will perform baseline testing for Apache Flink after installation on a GCP SUSE VM. Baseline testing validates that your installation is correct, the JVM is functioning properly, and Flink’s JobManager/TaskManager can execute jobs successfully.

## Install Maven (Required to Build and Run Flink Jobs)
Before running Flink jobs, ensure that Maven is installed on your VM. Many Flink examples and real-world jobs require Apache Maven to compile Java applications.

## Install Maven
```bash
cd /opt
sudo wget https://archive.apache.org/dist/maven/maven-3/3.8.6/binaries/apache-maven-3.8.6-bin.tar.gz
sudo tar -xvzf apache-maven-3.8.6-bin.tar.gz
sudo mv apache-maven-3.8.6 /opt/maven
```

## Configure environment variables
Configure the environment so Maven commands can be run system-wide:
```bash
echo "export M2_HOME=/opt/maven" >> ~/.bashrc
echo "export PATH=\$M2_HOME/bin:\$PATH" >> ~/.bashrc
source ~/.bashrc
```
Verify the Maven installation:
```bash
mvn -version
```
The output is similar to:
```
__output__ pache Maven 3.8.6 (84538c9988a25aec085021c365c560670ad80f63)
__output__ Maven home: /opt/maven
__output__ Java version: 17.0.13, vendor: N/A, runtime: /usr/lib64/jvm/java-17-openjdk-17
__output__ Default locale: en, platform encoding: UTF-8
__output__ OS name: "linux", version: "5.14.21-150500.55.124-default", arch: "aarch64", family: "unix"
```

## Start the Flink cluster
Before launching Flink, open port 8081 in the Google Cloud Firewall Rules so that the Web UI is reachable externally.
```bash
cd $FLINK_HOME
./bin/start-cluster.sh
```
The output is similar to:
```
__output__ Starting cluster.
__output__ [INFO] 1 instance(s) of standalonesession are already running on lpprojectsusearm64.
__output__ Starting standalonesession daemon on host lpprojectsusearm64.
__output__ Starting taskexecutor daemon on host lpprojectsusearm64.
```
Verify that the Flink processes (JobManager and TaskManager) are running:
```bash
jps
```
The output is similar to:
```
__output__ 21723 StandaloneSessionClusterEntrypoint
__output__ 2621 Jps
__output__ 2559 TaskManagerRunner
```
`StandaloneSessionClusterEntrypoint` is the JobManager process, and `TaskManagerRunner` is the worker responsible for executing tasks and maintaining state.

## Access the Flink Web UI
In a browser, navigate to `http://<VM_IP>:8081`.

You should see the Flink Dashboard:

![Flink Dashboard](https://learn.arm.com/learning-paths/servers-and-cloud-computing/flink-on-gcp/images/flink-dashboard.png "Flink Dashboard")
A successfully loaded dashboard confirms the cluster network and UI functionality. This serves as the baseline for network and UI validation.

## Run a simple example job
A basic check is to run the built-in WordCount example:
```bash
cd $FLINK_HOME
./bin/flink run examples/streaming/WordCount.jar
```
You can monitor the job in the Web UI or check console logs.

![WordCount job in Flink Dashboard](https://learn.arm.com/learning-paths/servers-and-cloud-computing/flink-on-gcp/images/wordcount.png "WordCount job in Flink Dashboard")
Flink baseline testing is complete. You can now proceed to Flink benchmarking.
