Skip to content

Commit

Permalink
vectortile: Set saner thread numbers
Browse files Browse the repository at this point in the history
The parallelism of tile rendering was incorrectly set to 4. This
sets it to a saner limit, as well as limits the CPUs used by
serving.
  • Loading branch information
pnorman committed Dec 24, 2024
1 parent 332e5e0 commit 7d85724
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions cookbooks/vectortile/attributes/default.rb
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
default[:vectortile][:database][:cluster] = "16/main"
default[:vectortile][:database][:postgis] = "3"
default[:vectortile][:database][:nodes_store] = :flat
default[:vectortile][:serve][:threads] = node.cpu_cores
default[:vectortile][:serve][:threads] = (node.cpu_cores*0.5).ceil
default[:vectortile][:serve][:mode] = :live
default[:vectortile][:replication][:url] = "https://osm-planet-eu-central-1.s3.dualstack.eu-central-1.amazonaws.com/planet/replication/minute"
default[:vectortile][:replication][:status] = :enabled
default[:vectortile][:replication][:tileupdate] = :enabled
default[:vectortile][:replication][:threads] = node.cpu_cores
default[:vectortile][:replication][:threads] = (node.cpu_cores*0.5).ceil

default[:postgresql][:versions] |= [node[:vectortile][:database][:cluster].split("/").first]
default[:postgresql][:monitor_database] = "tiles"
# As an absolute worst case, the server might have the serving, update, and a manual generation process going on.
default[:postgresql][:settings][:defaults][:max_connections] = (node.cpu_cores * 6 + 20).to_s
default[:postgresql][:settings][:defaults][:max_connections] = (node[:vectortile][:serve][:threads] * 2 + node[:vectortile][:replication][:threads] * 2 + node.cpu_cores * 2 + 20).to_s
default[:accounts][:users][:tileupdate][:status] = :role
default[:accounts][:users][:tilekiln][:status] = :role
2 changes: 1 addition & 1 deletion cookbooks/vectortile/recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@
owner "root"
group "root"
mode "755"
variables :tilekiln_bin => "#{tilekiln_directory}/bin/tilekiln", :source_database => "spirit", :storage_database => "tiles", :config_path => "#{shortbread_config}", :tiles_file => "/srv/vector.openstreetmap.org/data/tiles.txt", :update_threads => 4
variables :tilekiln_bin => "#{tilekiln_directory}/bin/tilekiln", :source_database => "spirit", :storage_database => "tiles", :config_path => "#{shortbread_config}", :tiles_file => "/srv/vector.openstreetmap.org/data/tiles.txt", :update_threads => node[:vectortile][:replication][:threads]
end

systemd_service "replicate" do
Expand Down

0 comments on commit 7d85724

Please sign in to comment.