Skip to content

Instantly share code, notes, and snippets.

@ayourtch
Created September 12, 2019 15:29
Show Gist options
  • Select an option

  • Save ayourtch/f4566532a483d07d07be008731188263 to your computer and use it in GitHub Desktop.

Select an option

Save ayourtch/f4566532a483d07d07be008731188263 to your computer and use it in GitHub Desktop.
a load-test script
job "run-test" {
datacenters = ["dc1"]
# datacenters = ["yul1"]
type = "batch"
group "run-test" {
count = 1
restart {
attempts = 0
interval = "900m"
delay = "15s"
mode = "fail"
}
ephemeral_disk {
size = 300
}
reschedule {
attempts = 0
unlimited = false
}
task "run-test" {
driver = "docker"
config {
image = "ayourtch/run-script:4"
shm_size = "1024000000"
}
resources {
cpu = 500 # 500 MHz
memory = 8192 # 256MB
network {
mbits = 10
}
}
template {
perms = "555"
destination = "local/run-script"
data = <<EOH
#!/bin/sh
sudo apt-get -y update
sudo apt-get install -y parallel
echo "Starting a load-test on disk subsystem"
while true; do
echo -e "1\n2\n3\n4\n" | parallel dd if=/dev/urandom of=/local/random-file{} bs=1M count=10000
done
EOH
}
# Controls the timeout between signalling a task it will be killed
# and killing the task. If not set a default is used.
# kill_signal = "SIGQUIT"
kill_timeout = "25s"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment