]> git.openstreetmap.org Git - chef.git/commitdiff
Better CPU/IO scheduling for cron on tilecaches
authorGrant Slater <git@firefishy.com>
Sun, 17 Nov 2019 15:16:39 +0000 (15:16 +0000)
committerGrant Slater <git@firefishy.com>
Sun, 17 Nov 2019 15:16:39 +0000 (15:16 +0000)
cookbooks/systemd/resources/service.rb
cookbooks/systemd/templates/default/service.erb
cookbooks/tilecache/recipes/default.rb

index 282b36178890afc90949c0b34a1452ed792038f6..4758f7af57f52b07fa056d7536b146b3246d8b5c 100644 (file)
@@ -62,6 +62,9 @@ property :no_new_privileges, [TrueClass, FalseClass]
 property :tasks_max, Integer
 property :timeout_sec, Integer
 property :pid_file, String
+property :nice, Integer
+property :io_scheduling_class, [Integer, String]
+property :io_scheduling_priority, Integer
 
 action :create do
   service_variables = new_resource.to_hash
index 46b8aa575f66b7646cbde14d9da156c600c51ab0..188404508470b65fb3c9f69e672a0c81a06a6796 100644 (file)
@@ -114,6 +114,15 @@ TimeoutSec=<%= @timeout_sec %>
 <% if @pid_file -%>
 PIDFile=<%= @pid_file %>
 <% end -%>
+<% if @nice -%>
+Nice=<%= @nice %>
+<% end -%>
+<% if @io_scheduling_class -%>
+IOSchedulingClass=<%= @io_scheduling_class %>
+<% end -%>
+<% if @io_scheduling_priority -%>
+IOSchedulingPriority=<%= @io_scheduling_priority %>
+<% end -%>
 <% unless @dropin -%>
 
 [Install]
index 1068b1b0d3903841215a4872758e960431eeda3f..63de8a529f92a3b85802077c3161d2e14fb18f91 100644 (file)
@@ -109,6 +109,16 @@ template "/etc/logrotate.d/squid" do
   mode 0o644
 end
 
+# Configure cron with lower cpu and IO priority
+systemd_service "cron-load" do
+  service "cron"
+  dropin "load"
+  nice 19
+  io_scheduling_class "best-effort"
+  io_scheduling_priority 7
+  notifies :restart, "service[cron]"
+end
+
 nginx_site "default" do
   action [:delete]
 end