A microservice placement strategy for low-resource settings using Docker Swarm.
- Overview
- Prerequisites
- Set Up the Docker Swarm
- Clone the Repository
- Deploy the Monitoring Stack
- Install Supporting Tools
- Deploy the HotelReservation Application
- Install Benchmarking Tools
- Network Performance Monitoring
- Install Rust and Cargo
- Running Yonga
For this demonstration, we use 6 CloudLab nodes:
- 1 manager node – orchestrates the Docker Swarm, runs monitoring tools, and executes benchmarks (wrk2).
- 5 worker nodes – run microservices and support distributed experiments.
The hotelreservation application from DeathStarBench acts as the test workload.
Update all nodes:
sudo apt update && sudo apt upgrade -yInstall Docker manually or use the automatic setup script (For the experiments, we use Docker 5:23.0.6-1ubuntu.22.04jammy):
./install_docker_swarm.shLabel the nodes appropriately in Docker Swarm: docker node update --label-add name=ocas05 9uo8i8n2889b0sgrauqj7xvml
docker node update --label-add name=ocasx [swarm-node-id]
......
docker node update --label-add name=ocasy [swarm-node-id]docker swarm init --advertise-addr <MANAGER-IP>Run the join command on each worker node:
docker swarm join --token XXXXXX <MANAGER-IP>:2377docker node lsgit clone https://github.com/crane-cloud/ocas.git
cd ocasManager:
sudo mkdir -p /var/mongodbAll nodes:
sudo mkdir -p /var/lib/node_exporterdocker stack deploy --compose-file monitor.yaml monitorCheck:
docker stack ls
docker service lssudo apt install python3-pip iperf3 jq bc clang llvm-dev libclang-dev -y
pip3 install tcp-latencydocker stack deploy --compose-file docker-compose.yaml hotelreservationsudo apt install luarocks libssl-dev zlib-dev -y
sudo luarocks install luasocketcd /tmp
git clone https://github.com/giltene/wrk2.git
cd wrk2
make
cp wrk ~/ocas/git clone https://github.com/delimitrou/DeathStarBench.git /tmp/DeathStarBench
cp -r /tmp/DeathStarBench/hotelReservation/wrk2/scripts ~/ocas/./wrk -t 10 -c 100 -d 10 -s ./scripts/hotel-reservation/mixed-workload_type_1.lua http://10.10.1.1:5000 -R 2000 -LScript:
/proj/cranecloud-PG0/ocas/scripts/yonga/perf.sh
Cron:
*/5 * * * * /bin/bash /proj/cranecloud-PG0/ocas/scripts/yonga/perf.sh X.X.X.X >> /var/log/ocas-perf.log 2>&1 && sudo mv /tmp/metrics.txt /var/lib/node_exporter/yonga.prom
Prepare files:
sudo touch /var/lib/node_exporter/yonga.prom
sudo touch /var/log/ocas-perf.log
sudo chmod 666 /var/lib/node_exporter/yonga.prom
sudo chmod 666 /var/log/ocas-perf.logStart iperf3 servers:
nohup iperf3 -s > /tmp/iperf3.log 2>&1 &curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/envRun the monitor service:
cd ocas/yonga
cargo run --release --bin monitor -- -c ../evaluation/config-dev.yamlcd ocas/yonga
cargo run --release --bin ocas -- -m ../docker-compose.yaml -p yonga -c ../evaluation/config-dev.yaml -u http://127.0.0.1:31000 -s hotelreservationRun the api service:
cd ocas/yonga
cargo run --release --bin api -- - c../evaluation/config-dev.yaml -p 31000
## Notes
Install docker-compose on all nodes
```bash
sudo apt install docker-compose -yChange to the hotelReservation directory and rebuild the images
cd /proj/cranecloud-PG0/ocas/hotelReservation
docker-compose buildTag the images appropriately and push to your Docker Hub repository if needed.
docker tag hotelreservation_service_name your_dockerhub_username/hotelreservation_service_name:latest
docker push your_dockerhub_username/hotelreservation_service_name:latestTo build the jaeger-mongodb binary from source for your platform, use the following instructions (https://github.com/mongodb-labs/jaeger-mongodb):
git clone https://github.com/mongodb-labs/jaeger-mongodb.git
cd jaeger-mongodb
GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build ./cmd/jaeger-mongodb # Specify your target OS and architectureYou may need to change the permissions for writability of /var/lib/node_exporter/yonga.prom
sudo chmod 666 /var/lib/node_exporter/yonga.promRun the script for multiple tests:
cd /proj/cranecloud-PG0/ocas/evaluation
for i in {1..10}; do echo "=== Run $i ==="; ./generate_workload.sh random /proj/cranecloud-PG0/ocas/scripts/hotel-reservation/mixed-workload_type_1.lua; sleep 10; done