From 73538f739b44b9788199b40c0940cf37ea9ebf0c Mon Sep 17 00:00:00 2001 From: Sam Smith Date: Tue, 13 Feb 2018 14:51:35 -0500 Subject: [PATCH] Set priority of consul agent to 'High' If the CPU is under load (99-100%) DNS lookups for internal CF components (through consul) will time out. By raising the priority of the consul process, we can ensure that it is never starved of CPU, preventing the timeouts [#154809327] Signed-off-by: Andrew Keesler --- jobs/consul_agent_windows/spec | 1 + jobs/consul_agent_windows/templates/post-start.ps1.erb | 6 ++++++ 2 files changed, 7 insertions(+) create mode 100644 jobs/consul_agent_windows/templates/post-start.ps1.erb diff --git a/jobs/consul_agent_windows/spec b/jobs/consul_agent_windows/spec index 9b1b14f..886ef8e 100755 --- a/jobs/consul_agent_windows/spec +++ b/jobs/consul_agent_windows/spec @@ -7,6 +7,7 @@ templates: confab.json.erb: confab.json consul_link.json.erb: consul_link.json pre-start.ps1.erb: bin/pre-start.ps1 + post-start.ps1.erb: bin/post-start.ps1 packages: - consul-windows diff --git a/jobs/consul_agent_windows/templates/post-start.ps1.erb b/jobs/consul_agent_windows/templates/post-start.ps1.erb new file mode 100644 index 0000000..f9b941d --- /dev/null +++ b/jobs/consul_agent_windows/templates/post-start.ps1.erb @@ -0,0 +1,6 @@ +$ErrorActionPreference = "Stop"; +trap { + $host.SetShouldExit(1) +} + +(Get-Process -Name consul).PriorityClass='High'