Skip to content

Instantly share code, notes, and snippets.

@aelsabbahy
Last active March 16, 2019 15:53
Show Gist options
  • Save aelsabbahy/29fb2772001688be3285 to your computer and use it in GitHub Desktop.
Save aelsabbahy/29fb2772001688be3285 to your computer and use it in GitHub Desktop.
Goss Benchmarks
#!/usr/bin/env bash
set -e
rm -f goss.json
# Add 100 files from etc
for x in `find /etc | head -100`;do goss add file "$x";done > /dev/null
# Add all users in /etc/passwd
for x in `cut -d':' -f 1 /etc/passwd`;do goss add user "$x";done > /dev/null
# Add all groups in /etc/groups
for x in `cut -d':' -f 1 /etc/group`;do goss add group "$x";done > /dev/null
# Add port 1-100
for x in {1..100};do goss add port "$x";done > /dev/null
for x in {1..100};do goss add port "tcp6:$x";done > /dev/null
# Add 20 packages
for x in `rpm -qa --qf "%{name}\n" | head -20`;do goss add package "$x";done > /dev/null
$ time goss validate --format nagios
GOSS OK - Count: 1122, Failed: 0, Duration: 0.052s
real 0m0.057s
user 0m0.104s
sys 0m0.091s
# Performance after dropping fs cache
$ sudo bash -c 'sync && echo 3 > /proc/sys/vm/drop_caches'
$ time goss validate --format nagios
GOSS OK - Count: 1122, Failed: 0, Duration: 0.060s
real 0m0.085s
user 0m0.134s
sys 0m0.093s
$ time goss validate --format nagios
GOSS OK - Count: 1049, Failed: 0, Duration: 0.080s
real 0m0.087s
user 0m0.189s
sys 0m0.152s
# Performance after dropping fs cache
$ sudo bash -c 'sync && echo 3 > /proc/sys/vm/drop_caches'
$ time goss validate --format nagios
GOSS OK - Count: 1049, Failed: 0, Duration: 2.249s
real 0m2.289s
user 0m0.195s
sys 0m0.288s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment