Get multipass.run
Get cloud-config-local.txt
curl -sSLO https://raw.githubusercontent.com/JadKHaddad/Openfaas-Performance-Testing-as-a-Service/main/cloud-config-local.txt
Replace the public key in cloud-config-local.txt with your own public key
Boot the VM:
multipass launch --cloud-init cloud-config-local.txt --name performance --cpus 2 --mem 2G --disk 10G
Get the VM's IP:
multipass info performance
Name: performance
State: Running
IPv4: 172.17.136.33
172.18.0.1
10.62.0.1
Release: Ubuntu 20.04.3 LTS
Image hash: db49f99b5162 (Ubuntu 20.04 LTS)
Load: 0.28 0.12 0.04
Disk usage: 7.8G out of 19.2G
Memory usage: 1.2G out of 6.0G
Mounts: --
IPv4: 172.17.136.33
Paste the VM's IP in your browser
The VM's IP may change with time. View the VM's IP if needed:
multipass info performance
Build the image:
docker build -t performance:1.0 .
Run the image in a container:
docker run -p 5000:8080 performance:1.0 -l -p 8080
Or run it in an interactive container:
docker run --rm -it -p 5000:8080 performance:1.0 -l -p 8080
Visit localhost:5000
Pull the official Redis image:
docker pull redis
Create a new network:
docker network create network
Run Redis:
docker run --rm -it --network network --name redis redis:latest
Run Performance:
docker run --rm -it -p 5000:8080 --network network performance:1.0 -l -p 8080 -r -rh redis
Or use docker-compose after building the image, creating the network and pulling redis:
docker-compose up
Visit localhost:5000
Install requirements:
pip3 install -r requirements.txt
pip3 install -r ptas/requirements.txt
Run: recommended:
navigate to /server/ directory:
cd server/
python3 server.py -l -p 5000
Visit localhost:5000
For more help use:
python3 server.py -h
usage: server.py [-h] [-v] [-e] [-l] [-r] [-rh] [-rp] [-re] [-rd] [-s] [-p] [-u] [-f] [-d]
optional arguments:
-h, --help help
-v, --version version
-e, --extern use if OpenFaaS is running on the external ip address of your machine
-l, --local use if you dont want to use an OpenFaaS server. server will run on 0.0.0.0:80 with no OpenFaaS server
-r, --redis use redis (cache). recommended if you dont have SSD
-rh, --redishost redis host, default: localhost
-rp, --redisport redis port, default: 6379
-re, --redisexpire redis (cache) expiration timer, default: 600 seconds
-rd, --redisdatabase redis database: 0 - 15, default: 0
required arguments:
-s, --host server host, default: 0.0.0.0
-p, --port server port, default: 80
-u, --url OpenFaaS url
-f, --function function name
-d, --direct can the browser connect to OpenFaaS directly?
- Windows comp.
- Jad K. Haddad jadkhaddad@gmail.com
© 2021 Jad K. Haddad Licensed under the MIT License.
Multipass + OpenFaaS + Performance Testing [Faasd + Containerd]
Multipass + OpenFaaS + Performance Testing [Kubernetes + Docker]
Multipass + OpenFaaS + Performance Testing [Microk8s + Docker]
Local Serverless Functions Deployment [Kubernetes + OpenFaaS]
Multipass Ubuntu-Host Port-Forwarding
Raising the Maximum Number of File Descriptors (Open Files) on Ubuntu
Faasd with Multipass
OpenFaaS Function without OpenFaaS