I would like always to be running a service job on my cluster, similar to Folding@Home, that scales up to make use of all available resources. I want it to be preempted when I run higher priority jobs then scale up to fill the remaining capacity again when the higher priority jobs finish.
Thanks! For this you will need to run the Nomad Autoscaler. You also need to have something like Prometheus running as well in order to collect you cluster metrics.
Take a look at this guide to get a quick start on how to use the Autoscaler.
Once you are more familiar with how it works, you will need to add a scaling policy to your job. You will also want to reduce the job’s priority so other jobs are able to preempt it.
Creating your policy query might be a bit challenging. Here’s the list of metrics that Nomad emits: Metrics | Nomad by HashiCorp
I think that, in your case, you would want something like
sum(nomad_client_unallocated_memory) / <AMOUNT OF MEMORY RESERVED FOR YOUR TASK>
All things considered, your job would look something like this: