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.
Follow these steps to set up the project:
- Clone the repo
git clone https://github.com/sampozz/ServerlessAutoscalingWithRL.git
- 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 listWhich should return an empty list [].
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 The following Python script creates a workflow with a single function deepspeech, starting from the systemfile.
cd figaro/systemfiles
python3 parser.py deepspeech.jsonYou can now check the list of registered functions on Serverledge:
docker compose exec -it serverledge bin/serverledge-cli listWhich 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 psThen 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.
The following Python script creates a workflow with the six VideoSearcher functions, starting from the systemfile.
cd figaro/systemfiles
python3 parser.py videosearcher.jsonYou can now check the list of registered functions on Serverledge:
docker compose exec -it serverledge bin/serverledge-cli listWhich 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 psThen 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.txtFinally, run the workflow:
docker compose exec -it serverledge bin/serverledge-cli invoke-workflow -f videosearcher_workflow -p "dir:example"To perform load testing on the serverledge instance, you can use Locust. Follow these steps:
-
Navigate to the
locustdirectory:cd figaro/workload_generator/locust -
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 -
Modify
locust_test.pyto set the constants for your test, i.e. serverledge host, port, workflow name, and the sinusoidal workload parameters. -
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 -
Once the test is complete, the logs are reported in
logsfolder. The logs can be analyzed with a Python notebook.
You can find the logs and the experiments related to the thesis in the figaro/workload_generator/thesis_experiments/ folder.
- 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.