# Benchmark Flink with nexmark-flink on Arm

## In this learning path

- [Introduction](https://learn.arm.com/learning-paths/servers-and-cloud-computing/flink/)
- [Setup and Configure Flink](https://learn.arm.com/learning-paths/servers-and-cloud-computing/flink/setup_flink/)
- [Setup and Config Nexmark](https://learn.arm.com/learning-paths/servers-and-cloud-computing/flink/setup_nexmark/)
- [Benchmark Flink with nexmark-flink on Arm](https://learn.arm.com/learning-paths/servers-and-cloud-computing/flink/benchmark_flink/)
- [Next Steps](https://learn.arm.com/learning-paths/servers-and-cloud-computing/flink/_next-steps/)

You are now ready to benchmark Flink with Nexmark on your Arm server.

## Flink Start

Start the Flink Cluster by running `flink/bin/start-cluster.sh` on the master node:

```bash
bash ~/flink-benchmark/flink-1.17.2/bin/start-cluster.sh
```

## Benchmark Setup

Setup the benchmark cluster by running `nexmark/bin/setup_cluster.sh` on the master node:

```bash
bash ~/flink-benchmark/nexmark-flink/bin/setup_cluster.sh
```

## Nexmark run

To run nexmark, type the following command:

```bash
bash ~/flink-benchmark/nexmark-flink/bin/run_query.sh
```

You can also run the benchmark with additional queries:

```bash
bash ~/flink-benchmark/nexmark-flink/bin/run_query.sh q1,q2
```

#### View the results

The sample output from running the benchmark is shown below:

```plaintext
__output__Benchmark Queries: [q0]
__output__==================================================================
__output__Start to run query q0 with workload [tps=10 M, eventsNum=100 M, percentage=bid:46,auction:3,person:1,kafkaServers:null]
__output__Start the warmup for at most 120000ms and 100000000 events.
__output__Stop the warmup, cost 120100ms.
__output__Monitor metrics after 10 seconds.
__output__Start to monitor metrics until job is finished.
__output__Current Cores=0 (0 TMs)
__output__Current Cores=0 (0 TMs)
__output__Current Cores=0 (0 TMs)
__output__Current Cores=0 (0 TMs)
__output__Current Cores=0 (0 TMs)
__output__Current Cores=0 (0 TMs)
__output__Current Cores=0 (0 TMs)
__output__Current Cores=0 (0 TMs)
__output__Current Cores=0 (0 TMs)
__output__Current Cores=0 (0 TMs)
__output__Current Cores=0 (0 TMs)
__output__Current Cores=0 (0 TMs)
__output__Current Cores=0 (0 TMs)
__output__Current Cores=0 (0 TMs)
__output__Current Cores=0 (0 TMs)
__output__Current Cores=0 (0 TMs)
__output__Current Cores=0 (0 TMs)
__output__Current Cores=0 (0 TMs)
__output__Summary Average: EventsNum=100,000,000, Cores=0, Time=106.258 s
__output__Stop job query q0
__output__-------------------------------- Nexmark Results --------------------------------
__output__+-------------------+-------------------+-------------------+-------------------+-------------------+-------------------+
__output__| Nexmark Query     | Events Num        | Cores             | Time(s)           | Cores * Time(s)   | Throughput/Cores  |
__output__+-------------------+-------------------+-------------------+-------------------+-------------------+-------------------+
__output__|q0                 |100,000,000        |0                  |106.258            |0.000              |9.22 E/s           |
__output__|Total              |100,000,000        |0.000              |106.258            |0.000              |9.22 E/s           |
__output__+-------------------+-------------------+-------------------+-------------------+-------------------+-------------------+
```
