Tool for testing Google Cloud autoscaling that generates VM instance CPU load on demand.
- Builds docker image and pushes it to current project Container Registry
- Creates Managed Instance Group (MIG) with instance template, autoscaling and health-checks for autohealing
- Each instance listens on external IP HTTP port for allowing you to:
- Generate/stop 100% CPU load on each instance
- Make unhealthy - disabling health-checks to test autohealing
- You can adjust settings (
CONFIG
file) for your testing:- Machine type used in MIG (smaller bigger CPU/Memory)
- Initialization time to simulate apps that require long time to start serving
- Autoscaler configuration
Follow instructions below and watch your MIG autoscale based on the load you generate. Change load and see how MIG autoscaler reacts.
-
Open Cloud Shell or your favorite terminal that has gcloud/docker/make installed.
-
Clone this repo
git clone https://github.com/epnasis/mig-cpuload.git
cd mig-cpuload/
- Skip this step if using Cloud Shell. Otherwise export your Google Cloud project to
GOOGLE_CLOUD_PROJECT
export GOOGLE_CLOUD_PROJECT=<your_project_here>
- Create new autoscaled MIG for testing:
make
(Optional) Repeat make
command to create more MIGs. You can adjust CONFIG file if you want to change MACHINE_TYPE
or other MIG/autoscaler configuration.
- Connect to your MIG instance using your browser to generate/stop load and test autoscaler features.
Click "Generate load" to create 100% utilization. Click "Stop load" to kill load at any time. Repeat for as many instances as you need in your testing scenario. You can also make instance unhealthy (disable health-checks) to trigger autohealing.
- Once done remove created resources with:
make clean
Update CONFIG
file to set instance group properties:
NAME=mig-cpuload
MACHINE_TYPE=e2-micro
ZONE=us-central1-a
MIN_NUM_REPLICAS=1
MAX_NUM_REPLICAS=10
TARGET_CPU_UTILIZATION=0.8
INIT_DELAY_SEC=0
- Recreate docker image - useful if you updated the app.py of CONFIG files
make docker
- Create new instance template
make mig-template
- Create new health-check
make mig-healthcheck
In case of questions contact [email protected]