Skip to content

Instantly share code, notes, and snippets.

@adamreese
Created January 12, 2022 18:20
Show Gist options
  • Save adamreese/a6f2bcd695e9f18d1b9a972bb19310bb to your computer and use it in GitHub Desktop.
Save adamreese/a6f2bcd695e9f18d1b9a972bb19310bb to your computer and use it in GitHub Desktop.
Nomad curl benchmark
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