Inspired by golang-memtest & go-cpu-load.
go get -u github.com/ntk148v/goload
- Basic:
# Allocate 1024MB memory in 20MB block
./goload mem -total 1024 -block 20
# Run 100% of all CPU cores for 10 seconds
./goload cpu -time 10
# Run 100% of 2 CPU cores for 10 seconds
./goload cpu -cores 2 -time 10
- Docker:
# Build image
$ docker build -t kiennt26/goload .
# Or simple pull from Hub docker
$ docker pull kiennt26/goload
$ docker run -it --rm -m 8m kiennt26/goload mem -total 10 -block 2
Alloc = 2 MB TotalAlloc = 2 MiB Sys = 8 MB NumGC = 0
Alloc = 4 MB TotalAlloc = 4 MiB Sys = 12 MB NumGC = 1
Alloc = 6 MB TotalAlloc = 6 MiB Sys = 16 MB NumGC = 1
# OOM -> Get killed at 8MB