Skip to content
This repository has been archived by the owner on Jul 14, 2023. It is now read-only.

Performance Testing as a Service using Multipass, OpenFaaS and Locust

License

Notifications You must be signed in to change notification settings

JadKHaddad/Openfaas-Performance-Testing-as-a-Service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Performance Testing

License: MIT OpenFaaS Multipass Locust Vue Redis Docker Kubernetes

Installation

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

Usage

Paste the VM's IP in your browser

Notes

The VM's IP may change with time. View the VM's IP if needed:

 multipass info performance

Or use Docker instead

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

You can also use a Redis container

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

Or install locally

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?

TODO

  • Windows comp.

Contributors

License & copyright

© 2021 Jad K. Haddad Licensed under the MIT License.

You may also like

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