Savanna Edge-to-Cloud: Chameleon Cloud + Edge
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 service on Chameleon Cloud testbed (animal classification using Deep Learning)
Configure an edge device on Chameleon Edge testbed (collect and compress wildlife images, then send images to the cloud service)
Configure the network between the edge device and cloud service.
Execute experiments and analyze results
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
chameleon # 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 Chameleon Cloud environment: chameleoncloud
).
The Edge Client (one Raspberry Pi 3 quantity: 1
in Chameleon Edge environment: chameleonedge
).
1---
2environment:
3 job_name: savanna-edge-cloud
4 walltime: "01:59:00"
5 chameleoncloud:
6 key_name: my-key-name
7 rc_file: "/path/to/my-app-cred-tacc-openrc.sh"
8 image: CC-Ubuntu20.04
9 chameleonedge:
10 rc_file: "/path/to/my-app-cred-edge-openrc.sh"
11layers:
12- name: cloud
13 services:
14 - name: Server
15 environment: chameleoncloud
16 cluster: compute_skylake
17 quantity: 1
18- name: edge
19 services:
20 - name: Client
21 environment: chameleonedge
22 servers: iot-rpi4-02
23 containers:
24 - name: cli-container
25 image: arm64v8/ubuntu
Note
In layers_services.yaml
, provide the path to your application credentials for each
Chameleon site in rc_file
and your key name in key_name
.
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: /
31 launch:
32 - debug:
33 msg: "Running the client"
34 - shell: "bash edge_worker.sh edge_data 100 {{ server.gateway }} True"
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 public
IP address to reach the Cloud Server as follows {{ server.gateway }}
.
Running & Verifying Experiment Execution
Find below the commands to deploy this application and check its execution.
$ e2clab deploy ~/git/savanna/chameleon/
~/git/savanna/artifacts/
Note
For the first deployment, a good practice is to do it incrementally, as explained here.
ssh to the Cloud server
$ ssh cc@<public_ip>
$ cc@<public_ip>:~# tail -f /tmp/predict.log
Note
You can find the public IP of the cloud server in the chameleon dashboard
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, 192.5.87.127
is the IP address of the cloud server.
$ python mosquitto_sub_img.py --topic edge_data --mqtt_broker 192.5.87.127
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/
, andworkflow-validate.out
experiment resutls: for each experiment a new directory is generated
20230623-150252/
.
$ ls ~/git/savanna/chameleon/20230623-150252/
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
Plotting the results: you can use the
~/git/savanna/artifacts/utils/plot_processing-time.py
Python script to plot the results as in Figure 2: Cloud-centric vs Edge+Cloud processing. Update the script according to your needs.