Savanna Edge-to-Cloud: Grid’5000 + FIT IoT LAB

../_images/g5k%2Bfitiot-logo.png

In this tutorial, we show how to analyze the performance of a real-life Edge-to-Cloud application deployed in the African savanna (illustrated in Figure 1: Edge-to-Cloud application).

This application is composed of distributed Edge devices monitoring animal migration in the Serengeti region. Devices at the Edge collect and compress wildlife images, then the image is sent to the Cloud where the animal classification happens using a pre-trained Neural Network model. Finally, classified data helps conservationists to learn what management strategies work best to protect species.

The goals of these experiments are to understand the impact on performance of Cloud-centric and Hybrid (Edge+Cloud) processing approaches.

In this example you will learn how to:

  • Configure a cloud server on Grid’5000 testbed (animal classification using Deep Learning)

  • Configure an edge device on FIT IoT LAB testbed (collect and compress wildlife images, then send images to the cloud server)

  • Configure the network between the edge device and cloud server.

  • Execute experiments and analyze results

../_images/savanna-setup.png

Figure 1: Edge-to-Cloud application

Experiment Artifacts

$ cd ~/git/
$ git clone https://gitlab.inria.fr/E2Clab/examples/savanna
$ cd savanna/
$ ls
artifacts          # contains artifacts for the cloud server and the edge device
g5k-fitiot         # contains layers_services.yaml, network.yaml, and workflow.yaml

Defining the Experimental Environment

Layers & Services Configuration

This configuration file presents the layers and services that compose this example. The Cloud Server (one machine quantity: 1 in Grid’5000 environment: g5k). The Edge Client (one Raspberry Pi 3 quantity: 1 in FIT IoT LAB environment: iotlab).

 1---
 2environment:
 3  job_name: savanna-edge-cloud
 4  walltime: "01:59:00"
 5  g5k:
 6    cluster: paravance
 7    job_type: ["allow_classic_ssh"]
 8    firewall_rules:
 9      - services: ["Server"]
10        ports: [1883]
11  iotlab:
12    cluster: grenoble
13layers:
14- name: cloud
15  services:
16  - name: Server
17    environment: g5k
18    quantity: 1
19- name: edge
20  services:
21  - name: Client
22    environment: iotlab
23    cluster: grenoble
24    archi: rpi3:at86rf233
25    quantity: 1

Note

We create a firewall rule on Grid’5000 to allow the Cloud Server to receive data from the Edge Client (FIT IoT LAB) in port 1883 MQTT (Message Queuing Telemetry Transport) protocol.

Network Configuration

The file below presents the network configuration between the cloud and edge infrastructures delay: 30ms, loss: 0.1%, rate: 512kbit.

1networks:
2- src: cloud
3  dst: edge
4  delay: 30ms
5  rate: 512kbit
6  loss: 0.1%

Workflow Configuration

This configuration file presents the application workflow configuration.

  • The Cloud Server cloud.server.*:

prepare copies from the local machine to the remote machine the artifacts

launch executes the Python application (animal classification using Deep Learning)

finalize after experiment ends, copies the results from the remote to the local machine

  • The Edge Client edge.client.*:

prepare copies from the local machine to the remote machine the artifacts

launch executes the client application (collect and compress wildlife images, then send images to the cloud server)

 1# SERVER
 2- hosts: cloud.server.*
 3  prepare:
 4    - copy:
 5        src: "{{ working_dir }}/artifacts_cloud/"
 6        dest: /tmp
 7  launch:
 8    - debug:
 9        msg: "Running the server"
10    - shell: cd /tmp && bash cloud_worker.sh > cloud-log.log
11    - shell: python3 /tmp/predict_loop.py
12      async: 3120
13      poll: 0
14  finalize:
15    - debug:
16        msg: "Saving results"
17    - fetch:
18        src: /tmp/predict.log
19        dest: "{{ working_dir }}/experiment-results/"
20        validate_checksum: no
21# CLIENT
22- hosts: edge.client.*
23  depends_on:
24    service_selector: cloud.server.*
25    grouping: "round_robin"
26    prefix: server
27  prepare:
28    - copy:
29        src: "{{ working_dir }}/artifacts_edge/"
30        dest: /tmp
31  launch:
32    - debug:
33        msg: "Running the client"
34    - shell: "cd /tmp && bash edge_worker.sh edge_data 100 {{ server.__address6__ }} True > edge-log.log"

Understanding the parameters of edge_worker.sh:

  • edge_data is the topic name

  • 100 is the number of times the edge device will send images to the Cloud (every 30 seconds)

  • True means Edge+Cloud processing approach (False means Cloud-only processing approach)

Note

Using depends_on on the Edge Client edge.client.* we can access the IPv6 address of the Cloud Server as follows {{ server.__address6__ }}.

Running & Verifying Experiment Execution

Find below the commands to deploy this application and check its execution.

$ e2clab deploy ~/git/savanna/g5k-fitiot/
                ~/git/savanna/artifacts/

Note

For the first deployment, a good practice is to do it incrementally, as explained here.

Firewall rule

ssh to the Cloud server

$ ssh root@paravance-40.rennes.grid5000.fr
$ root@paravance-40:~# tail -f /tmp/predict.log

You may also check the mosquitto topic

You can use the Python script at ~/git/savanna/artifacts/utils/mosquitto_sub_img.py to download images received. Images will be downloaded in the directory you run the script. In the example below, 2001:660:4406:700:1::28 is the IPv6 address of the cloud server.

$ python mosquitto_sub_img.py --topic edge_data --mqtt_broker 2001:660:4406:700:1::28

Deployment Validation & Experiment Results

Find below the files generated after the execution of each experiment. It consists of:

  • validation files: layers_services-validate.yaml, network-validate/, and workflow-validate.out

  • experiment resutls: for each experiment a new directory is generated 20230623-113827/.

$ ls ~/git/savanna/g5k-fitiot/20230623-113827/

layers_services-validate.yaml   # Mapping between layers and services with physical machines
network-validate/               # Network configuration for each physical machine
workflow-validate.out           # Commands used to deploy application (prepare, launch, and finalize)
experiment-results/             # Experiment results
../_images/plot-g5k-fit.png

Figure 2: Cloud-centric vs Edge+Cloud processing