It’s a similar concept to distinct_hosts but instead of a constraining Nomad to a single task instance per client node, it should be N task instances per client node.
For example, our performance testing cluster has 3 clients. I want to run 6 instances total and have each client node run 2 instances. Our performance cluster includes Consul and Fabio.
Here’s a test job file using httpecho:
job "http-echo-hostnametest" {
datacenters = ["dc1"]
constraint {
attribute = "${attr.kernel.name}"
value = "linux"
}
group "echo" {
count = 6
task "server" {
driver = "docker"
config {
image = "hashicorp/http-echo:latest"
args = [
"-listen", ":${NOMAD_PORT_http}",
"-text", "Welcome to ${NOMAD_ADDR_http}"
]
}
resources {
memory = 300
network {
mbits = 10
port "http" {}
}
}
service {
name = "http-echo-hostnametest"
port = "http"
tags = [
"hostnametest",
"urlprefix-/test"
]
check {
type = "http"
path = "/health"
interval = "2s"
timeout = "2s"
}
}
}
}
}