Skip to content

About

Serverless Autoscaling with Reinforcement Learning across the Computing Continuum

Resources

Stars

3 stars

Watchers

0 watching

Forks

 
 

Repository files navigation

Getting Started

Prerequisites

Required software and tools to run the project.

  • Python 3.12
  • Python pip 24.0
  • Make
  • Docker
  • Docker Compose

The project has been tested on Ubuntu 24.04.1 LTS.

Installation

Follow these steps to set up the project:

  1. Clone the repo
    git clone https://github.com/sampozz/ServerlessAutoscalingWithRL.git
  2. Run the setup script
    chmod +x setup.sh
    ./setup.sh

You can now check the list of registered functions on Serverledge:

docker compose exec -it serverledge bin/serverledge-cli list

Which should return an empty list [].

Usage

After installation, you can interact with serverledge via docker compose.

You can check the available commands provided by the serverledge-cli tool:

docker compose exec -it serverledge bin/serverledge-cli 

Deepspeech workflow

The following Python script creates a workflow with a single function deepspeech, starting from the systemfile.

cd figaro/systemfiles
python3 parser.py deepspeech.json

You can now check the list of registered functions on Serverledge:

docker compose exec -it serverledge bin/serverledge-cli list

Which should return a list with the deepspeech function.

The controller also starts interacting with the agents, so the first function instances will be prewarmed and they can be checked by running:

docker ps

Then create the input files in the /mnt/ramdisk directory:

cd ../../
# Video file to process
cp examples/videosearcher/video_cut.mp4 /mnt/ramdisk/video.mp4 
# Text file with the string to search in the video
echo "depression" > /mnt/ramdisk/params.txt
# Create the intermediate input files for deepspeech
mkdir -p /mnt/ramdisk/example
cp examples/videosearcher/video_ffmpeg_2_output_?.tar.gz /mnt/ramdisk/example/

Finally, run the workflow:

docker compose exec -it serverledge bin/serverledge-cli invoke-workflow -f deepspeech_workflow -p "dir:example"

The results will be stored in the /mnt/ramdisk/example directory.

VideoSearcher workflow

The following Python script creates a workflow with the six VideoSearcher functions, starting from the systemfile.

cd figaro/systemfiles
python3 parser.py videosearcher.json

You can now check the list of registered functions on Serverledge:

docker compose exec -it serverledge bin/serverledge-cli list

Which should return a list with the six functions of VideoSearcher.

The controller also starts interacting with the agents, so the first function instances will be prewarmed and they can be checked by running:

docker ps

Then create the input files in the /mnt/ramdisk directory:

cd ../../
# Video file to process
cp examples/videosearcher/video_cut.mp4 /mnt/ramdisk/video.mp4 
# Text file with the string to search in the video
echo "depression" > /mnt/ramdisk/params.txt

Finally, run the workflow:

docker compose exec -it serverledge bin/serverledge-cli invoke-workflow -f videosearcher_workflow -p "dir:example"

Load Testing with Locust

To perform load testing on the serverledge instance, you can use Locust. Follow these steps:

  1. Navigate to the locust directory:

    cd figaro/workload_generator/locust
  2. Create and activate a Python virtual environment, then install the required dependencies:

    python3 -m venv .venv
    source .venv/bin/activate
    pip install -r requirements.txt
  3. Modify locust_test.py to set the constants for your test, i.e. serverledge host, port, workflow name, and the sinusoidal workload parameters.

  4. Run Locust:

    locust -f locust_test.py --headless -u 1 -r 1 --run-time 60m
    # Note: the run-time should be set according to the trace generated inside the locust_test.py script
  5. Once the test is complete, the logs are reported in logs folder. The logs can be analyzed with a Python notebook.

Thesis experiments

You can find the logs and the experiments related to the thesis in the figaro/workload_generator/thesis_experiments/ folder.

Known Issues

  • If Serverledge receives an invocation request for a function but there are no container instances for that function (neither warm or busy), the request is put in a queue. However, if a container instance is started later, the queued requests are not processed. Serverledge needs to be restarted. This happens because the queued requests are only processed after the completion of other requests for the same function.

About

Serverless Autoscaling with Reinforcement Learning across the Computing Continuum

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages