Created
January 12, 2022 18:20
-
-
Save adamreese/a6f2bcd695e9f18d1b9a972bb19310bb to your computer and use it in GitHub Desktop.
Nomad curl benchmark
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
variable "url" { | |
type = string | |
default = "google.com" | |
} | |
variable "template" { | |
type = string | |
default = <<-EOF | |
%%%{errormsg} | |
http_code: %%%{response_code} | |
---------- | |
curl timing report | |
namelookup: %%%{time_namelookup} | |
connect: %%%{time_connect} | |
appconnect: %%%{time_appconnect} | |
pretransfer: %%%{time_pretransfer} | |
redirect: %%%{time_redirect} | |
starttransfer: %%%{time_starttransfer} | |
---------- | |
total: %%%{time_total} | |
EOF | |
} | |
job "benchmark" { | |
datacenters = ["dc1"] | |
type = "batch" | |
group "benchmark" { | |
count = 1 | |
task "benchmark" { | |
driver = "raw_exec" | |
config { | |
command = "curl" | |
args = [ | |
"-so", "/dev/null", | |
"-w", var.template, | |
var.url, | |
] | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment